View Single Post
  #2 (permalink)  
Old May 2nd, 2005, 10:02 PM
statusquo statusquo is offline
Registered User
Join Date: May 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

I found the cause of the sql error.

fieldnames should have back ticks around them instead of single quotes. (the back tick is the key to the left of the 1 key in the upper left corner.... in case you were wondering). Single quotes are fine for the values....but back ticks for field names.

The corrected code looks like this :

$sql = "UPDATE 
        `movie_name` = '".$_POST['movie_name']."', 
        `movie_year` = '".$_POST['movie_year']."', 
        `movie_type` = '".$_POST['movie_type']."', 
        `movie_leadactor` = '".$_POST['movie_leadactor']."', 
        `movie_director` = '".$_POST['movie_director']."' 
        `movie_id` = ".$_GET['id'];
They look similar, but can be the difference between an updated table and a sql error.

Hope this helps someone.