Page 1 of 1

PHP assignment crisis

Posted: Wed Apr 29, 2009 3:35 pm
by neptunes07
Hey i am doing a project and i keep getting the following error 'Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3'

all the code in the site is correct can someone please help

Re: PHP assignment crisis

Posted: Wed Apr 29, 2009 3:48 pm
by Benjamin
You have a variable mispelled on line 2.

Re: PHP assignment crisis

Posted: Wed Apr 29, 2009 5:05 pm
by nathan_nateben
Try something like this to find your SQL problem.

Code: Select all

 
$query = "SELECT value FROM table WHERE value=1";
if(mysql_query($query))
{
  //no errors.
  echo "no error.";
}
else
{
   echo "An SQL error occured.<BR><BR>Error: " . mysql_error() . "<BR><BR>Query: " . $query;
}
 
Note: this is only for debugging, never publish a file with such detailed error messages.