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
PHP assignment crisis
Moderator: General Moderators
Re: PHP assignment crisis
You have a variable mispelled on line 2.
-
nathan_nateben
- Forum Newbie
- Posts: 4
- Joined: Wed Apr 29, 2009 4:57 pm
Re: PHP assignment crisis
Try something like this to find your SQL problem.
Note: this is only for debugging, never publish a file with such detailed error messages.
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;
}
Last edited by Benjamin on Wed Apr 29, 2009 5:30 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Reason: Changed code type from text to php.