Jump to content

Simple MySql Query Not Working! Please Help


paulman888888

Recommended Posts

Hello;

I keep getting this error

MySql Error

Which is not really an error because it doesnt tell whats wrong.

 

Here's my code

$check=mysql_query("UPDATE chess_events SET delete='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")or die(mysql_error);

 

 

Please can you tell me what i have done wrong and why MySql Doesn't Give Me An Error!

 

Thankyou

Paul

Link to comment
Share on other sites

your error checking is wrong...it should be:

$check=mysql_query("UPDATE chess_events SET delete='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")or die(mysql_error());

 

but the problem is with your field "delete". delete is a reserved word, and it's bad practice to use it as a field name. if you can, change it (maybe use 'removed' instead). if you can change it, use backticks to escape it:

$check=mysql_query("UPDATE chess_events SET `delete`='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")or die(mysql_error());

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.