Jump to content


Photo

query won't work


  • Please log in to reply
1 reply to this topic

#1 kristin Lai

kristin Lai
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 30 March 2006 - 04:13 PM

Okay, I can't for the life of me figure out what's wrong with this query but I keep getting the "not a valid result resource" error message. I've checked that the db fieldname is spelled correctly and there is a value stored in the $image variable so any suggestions would really help. Here's the query:

$queryImg = "SELECT * FROM images WHERE imgID=$image";
$resultImg = mysql_query($queryImg)
	or die ("could not retrieve image");
$rowImg = mysql_fetch_array($queryImg,MYSQL_ASSOC);
extract ($rowImg);


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 30 March 2006 - 04:27 PM

You need
$queryImg = "SELECT * FROM images WHERE imgID='$image'";
$resultImg = mysql_query($queryImg)
or die ("could not retrieve image");
$rowImg = mysql_fetch_array($queryImg,MYSQL_ASSOC);
extract ($rowImg);

as '$image' show's it as a string but without the '' it looks for it as a field :)
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users