PHP assignment crisis

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neptunes07
Forum Newbie
Posts: 1
Joined: Wed Apr 29, 2009 3:32 pm

PHP assignment crisis

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP assignment crisis

Post by Benjamin »

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

Post 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.
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.
Post Reply