Page 1 of 1

What am I doing wrong?

Posted: Wed Nov 07, 2012 6:48 am
by Goofan
Currently the code below gets an error message:
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 'WHERE id='1'' at line 2

Code: Select all

include_once("DB_Class.php");
		$db = new database();
		$mydb = "UPDATE my_research SET bet='" .$bet ."',
				WHERE id='" .$id ."'"; 
		$db->dbquery($mydb);
I got almost an identical query call on another page working perfectly. Why isn't this working?

(Sorry for thee vague information writing on my way out)

Regards,
Thomas

Re: What am I doing wrong?

Posted: Wed Nov 07, 2012 6:53 am
by social_experiment

Code: Select all

 $mydb = "UPDATE my_research SET bet='" .$bet ."', WHERE id='" .$id ."'";
The , before the WHERE clause is causing the problem