Jump to content

What the hell is wrong with this!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Bioshox

Bioshox

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 207 posts
Hey guy's im tearing my hair out here.

The following code outputs the following error when executed;

Quote

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 'desc = 'Test'' at line 1



		//How to update the name

		$post_new_content = $_POST['keywords']; //get the user-admin filled in new content for the post 

		$update_post = mysql_query("UPDATE bloginfo SET keywords = '".addslashes(mysql_real_escape_string($_POST['keywords']))."'  ")or die(mysql_error()); 

	

		//How to update the name

		$post_new_desc = $_POST['desc']; //get the user-admin filled in new content for the post 

		$update_desc = mysql_query("UPDATE bloginfo SET desc = '".addslashes(mysql_real_escape_string($_POST['desc']))."'  ")or die(mysql_error()); 


Can anyone find the error D:

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Not that hard. Your column name `desc` is a MySQL keyword. Use back-ticks around it to avoid the syntax issue.
        $update_desc = mysql_query("UPDATE bloginfo SET `desc` = '".addslashes(mysql_real_escape_string($_POST['desc']))."'  ")or die(mysql_error());