Page 1 of 1

Why is this a parse error?

Posted: Sun Mar 16, 2003 9:36 am
by bobthebobert

Code: Select all

<?php

$result = mysql_query("SELECT kingname FROM info WHERE (rulername="bob")");


?>
Where is the parse error, I can't find it -.-

Posted: Sun Mar 16, 2003 9:43 am
by twigletmac
You've got double quotes within a double quoted string and you haven't escaped them. This would work:

Code: Select all

$result = mysql_query("SELECT kingname FROM info WHERE (rulername="bob")");
but since this is an SQL statement you can and should use single quotes instead:

Code: Select all

$result = mysql_query("SELECT kingname FROM info WHERE (rulername='bob')");
Mac

Posted: Sun Mar 16, 2003 11:05 am
by bobthebobert
Grrr, thankyou, i figured it was something stupid like that =/

I will eventually figure it out though!