Dumb Question
Posted: Sat Jan 19, 2008 10:34 am
Part of some code, this part in fact
simply isn't working. All the rest of the code is and this part doesn't produce an error (either SQL or PHP). It returns Die Number: and the right $value to the screen, but then nothing for $imageref["revimage"] as if the query had not returned anything for that entry. Except that I can make it echo the whole sql statement to the screen and then plug that directly into MySQL and it works fine, returning exactly the record I expected.
I'm not getting anywhere with this one, can someone suggest what I've overlooked.
Rhanks,
Robert
Code: Select all
foreach ($dieresults as $key => $value){
$sql = "SELECT * FROM images WHERE prefer =1 AND coin = (SELECT coinID FROM `main` WHERE `".$table."` = '".$value."' LIMIT 0 , 1) LIMIT 0 , 1";
$imageref = mysql_query($sql) or die('Query failed: ' . mysql_error());
echo ("<p>Die Number:".$value." ");
echo ($imageref["revimage"]);
}
}
I'm not getting anywhere with this one, can someone suggest what I've overlooked.
Rhanks,
Robert