Page 1 of 1

What's wrong with this code?

Posted: Thu Oct 05, 2006 8:42 pm
by speedy33417
I'm getting an error here. Why?

Code: Select all

$update = mysql_query("UPDATE pictures SET picture_viewed = '$result['picture_viewed']' WHERE picture_number = '$picture' AND picture_album = '$album' LIMIT 1") or die(mysql_error());
Thanks.

Posted: Thu Oct 05, 2006 8:45 pm
by Luke
I would imagine it has to do with '$result['picture_viewed']' because you are nesting single quotes... which is not allowed. For future reference, you need to use more descriptive thread titles and when you have an error... post it.

Posted: Thu Oct 05, 2006 10:37 pm
by Flamie
yep, the space goat is right :)

Code: Select all

$update = mysql_query("UPDATE pictures SET picture_viewed = '".$result['picture_viewed']."' WHERE picture_number = '$picture' AND picture_album = '$album' LIMIT 1") or die(mysql_error());
Voila =)

Posted: Thu Oct 05, 2006 11:52 pm
by s.dot
curly braces are pretty kewl too

{$something['something']}

gives you an option :D