ID: 13055
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: GetImageSize related
Operating System: Win98SE & UNIX
PHP Version: 4.0.6
New Comment:

Please ask support questions on the mailing lists:

http://www.php.net/support.php

Also reading the manual would help.

--Jani


Previous Comments:
------------------------------------------------------------------------

[2001-08-31 07:50:18] [EMAIL PROTECTED]

user feedback:
*****************************

From: "Malcolm Clark" <[EMAIL PROTECTED]>
To: "Bug Database" <[EMAIL PROTECTED]>
Date: Thu, 30 Aug 2001 19:12:10 +0100

> What is the error message you get?

No Database selected

> And please add a SHORT standalone example script
> which does not depend on databases.

I don't think this is possible, considering the above error msg emanates
from a db request. ( mysql_error(); )
I suggest using any mysql db on your system and changing  $C_db in
config.ini to the name of the test db you want to use. I've tried it here
and still get the problem. :(  Finally make up a simple INSERT statement or
something.

*****************************

next time, use the web interface for replies. direct link to your PR is included in 
every mail from the bug db.

------------------------------------------------------------------------

[2001-08-30 12:07:23] [EMAIL PROTECTED]

What is the error message you get? 
And please add a SHORT standalone example script
which does not depend on databases.

--Jani


------------------------------------------------------------------------

[2001-08-30 06:23:00] [EMAIL PROTECTED]

I have isolated the problem domain in the following script. Required files are below 
it. Assuming you have a db created, the script duly INSERTs. Remove the comments from 
//$size... and I get this error,"No Database selected", and yet you can $db1->getdb(); 
to simultaneously echo the db chosen. I tried ImageSX hoping to find a way round, but 
alas....I'm here with a bug report.

<?
require ("config.ini");
require ("mysqldb.obj");

$img_path = "C:\Program Files\Apache 
Group\Apache\htdocs\img\images\marked\image6.png";
//$size    = GetImageSize($img_path);

$db1 = new mysqldb();
$db1->setsql("INSERT INTO images 
        (img_desc,img_fname,img_fsize,img_ftype,
        img_xval,img_yval,img_tn_grp,img_cat,
        img_angle,img_admit,img_up_date) 
        VALUES 
        (\"$img_desc\",\"$image_fname\",\"$uploaded_image_size\",
        \"$uploaded_image_type\",\"$img_xval\",\"$img_yval\",
        \"$img_tn_grp\",\"$img_cat\",\"$img_angle\",\"N\",\"$img_up_date\")
        "); 

if(!$db1->deladdmod()){echo $db1->err ;exit;}


// 

?>

config file
**********


<?

// FILE PATHS

$C_image_fpath          = "C:\\Program Files\\Apache 
Group\\Apache\\htdocs\\img\\images\\uploads\\orig\\";
$C_thumb_fpath          = "C:\\Program Files\\Apache 
Group\\Apache\\htdocs\\img\\images\\uploads\\thumbs\\";
// archive paths
$C_image_fpathA         = "C:\\Program Files\\Apache 
Group\\Apache\\htdocs\\img\\images\\archive\\orig\\";
$C_thumb_fpathA         = "C:\\Program Files\\Apache 
Group\\Apache\\htdocs\\img\\images\\archive\\thumbs\\";


// DATABASE

$C_host                 = "localhost";
$C_db                   = "photo";
$C_username             = "";
$C_password             = "";

$C_table1               ="images";
$C_table2               ="author";
$C_table3               ="archive";

//  # MAPS in grid

$C_map_num              = 9;
        

// makemap.obj

$MARKER_RGB             = array (array("red","255","0","0"),
                                 array("blue","0","0","255"));
$MARKER_FONT            = "ARIAL.TTF";
$MARKER_FONT_SIZE       = "10";
$MARKER_TYPE            = array ( ">" , "&#164;");



// IMG FILES - supported file types and max upload fsize

$C_img_types            =       ".jpg/.jpeg";
$C_max_fsize            =       "200";
$C_max_fsize_bytes      =       "204800";

// SITE

$C_site_name            = "PEAKAROUND";
$C_site_title           = "<B>THE SAWDS GALLERY&#153;</B>";
$C_site_title_txt       = "THE SAWDS GALLERY";
//$C_nav_back           =       "";
$C_faq_txt              = "Please refer to the HELP pages.";


// MAIL

$C_mail_admin   = "[EMAIL PROTECTED]";
$C_mail_from            = "[EMAIL PROTECTED]";
$C_mail_feedback        = "[EMAIL PROTECTED]";


// LOGIC

$C_true                 = 1;    
$C_false                = 0;

?>

mysqldb.obj
************
<?

        class mysqldb 
        {
        
                var $host;
                var $db;
                var $dbuser;
                var $dbpassword;
                var $sql;
                var $numberrows;
                var $dbopenstatus;
                var $dbconnection;
                var $err;
                var $qry;
                
        // Property Get & Set
        
                function gethost() {
                        return $this->dbhost;
                }
                
                function sethost($req_host) {
                        $this->dbhost = $req_host;
                        
                }
                
                function getdb() {
                        return $this->db;
                }
                
                function setdb($req_db) {
                        $this->db = $req_db;
                }
                
                function getdbuser() {
                        return $this->dbuser;
                }
                
                function setdbuser($req_user) {
                        $this->dbuser = $req_user;
                }
                
                function getdbpassword() {
                        return $this->dbpassword;
                }
                
                function setdbpassword($req_password) {
                        $this->dbpassword = $req_password;
                }
                
                function getsql() {
                        return $this->sql;
                }
                
                function setsql($req_sql) {
                        $this->sql = $req_sql;
                }
                
                function getnumberrows() {
                        return $this->numberrows;
                }
                
                function setnumberrows($req_numberresults) {
                        $this->numberrows = $req_numberresults;
                }
        
                function setdbconnection($req_dbconnection) {
                        $this->dbconnection = $req_connection;
                }
                
                function getdbconnection() {
                        return $this->dbconnection;
                }
        
        // Constructor
        
                function mysqldb() {
                
                        global $C_host, $C_db, $C_username, $C_password;
                        global $C_true, $C_false;
                        
                        $this->sethost($C_host);
                        $this->setdb($C_db);
                        $this->setdbuser($C_username);
                        $this->setdbpassword($C_password);
                        $this->setdbconnection($C_false);

                }
                
        // Methods
        
                function opendbconnection() {

                        global $C_true, $C_false;
                        
                        $this->dbconnection = mysql_connect("$GLOBALS[C_host]", 
"$GLOBALS[C_username]", "$GLOBALS[C_password]");
                        if ($this->dbconnection == $C_true) {
                                $this->db = mysql_select_db("$GLOBALS[C_db]");
                                $this->setdbconnection($C_true);
                        } else {
                                $this->setdbconnection($C_false);
                                $this->err = mysql_error();
                                return false;
                        }
                        return true;
                }
                
                function closedbconnection() {

                        if ($this->dbconnection = $C_true) {
                                mysql_close($this->dbconnection);
                        }
                        
                }

                function selectquery() 
                {
                        
                        global $C_true, $C_false;

                        if ($this->dbconnection == $C_false) {
                                $this->opendbconnection();
                        }

                        $this->qry = mysql_query($this->sql);
                        if (!$this->qry) {
                                $this->err = mysql_error();
                                return false;
                        } 
                        else 
                        {
                                $this->setnumberrows(mysql_num_rows($this->qry));
                                
                                if ($this->getnumberrows() > 0)
                                {
                                        for($x = 0; $x < $this->getnumberrows(); $x++) 

                                        {
                                                $this->row[$x] = 
mysql_fetch_array($this->qry);                                
                                        }
                                } 
                                else 
                                {
                                        return false;
                                }
                                return true;
                        }
                }
                
                
                function deladdmod() 
                {
                        
                        global $C_true, $C_false;

                        if ($this->dbconnection == $C_false) {
                                $this->opendbconnection();
                        }

                        $this->qry = mysql_query($this->sql);
                        if (!$this->qry) {
                                $this->err = mysql_error()."eeeee";
                                return false;
                        } 
                        return true; //needed for eg if(!$db1->deladdmod()) {...}
                        
                }
                
                
                
                
                
                
                
                
                
                
                
                

        }       
?>



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13055&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to