08-05-2009, 01:54 PM
|
#10 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
Originally Posted by tony
I think the error is here:
PHP Code:
$imageresult = mysql_query('SELECT id FROM isearch WHERE imageurl="$filename"');
Single quotes strings don't parse the contents of a variable, everything is a string for them. try this:
php Code:
$imageresult = mysql_query('SELECT id FROM isearch WHERE imageurl="' . $filename . '"');
or this
php Code:
$imageresult = mysql_query("SELECT id FROM isearch WHERE imageurl='$filename'");
I prefer the first one, easy to read in text editors plus it gains a bit of speed.
|
Or you could use TalkPHP's favorite function : sprintf (if a website can have favorites  )
PHP Code:
$imageresult = mysql_query(sprintf("SELECT `id` FROM `isearch` WHERE `imageurl` = '%s'", mysql_real_escape_string($filename)));
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
Last edited by sketchMedia : 08-05-2009 at 01:56 PM.
Reason: added escaping
|
|
|
|