For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > November 2004 > getimagesize & Mysql class









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author getimagesize & Mysql class
Malcolm Jc Clark

2004-11-06, 8:55 pm

Hi!


When i run the following code, mysql_error() = "No Database Selected" and
mysql_errno() is "1046".

After nearly going insane, I realised through trial and error that if i
commented out the call to getimagesize() and fed the DB class with some data
of my own, it all worked perfectly.

I also placed a call to $db->getDbName() in the code (not visible below)
and it provided a db name, which was odd since it says there was "No
Database Selected".

The db class has not failed anywhere else in my code. The error seems to
occur only if the db class is used following use of getimagesize()

I also managed to update the Mysql db without using a class. So, there
appears to be nothing wrong with my class, because it works elsewhere, but
it also appears that invoking MYSQL commands through a class after a call to
getimagesize() does not work.


Surely millions of users use a db class to update a db with image dimensions
etc!?



TIA


Malcolm



Should you need to look at classes in use, please view at
ftp://sawds.dsvr.co.uk/general/


<?
require_once("../class_MysqlDb.php");


$img_attrib = getimagesize('images/piki.jpg');

$img_width = $img_attrib[0];
$img_height = $img_attrib[1];


$db = new MysqlDb();
//echo mysql_error()."<p>".mysql_errno();exit;
$result = $db->query("
UPDATE page SET
page_img_width = \"$img_width\",
page_img_height = \"$img_height\"

");



if(!$result) echo mysql_error()."<p>".mysql_errno();exit;
$db->closedbConnection();


?>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com