Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to UPDATE a record. Getting a SQL error. Help!

    I am following this from a book. Can anyone tell me if this is right, if it is then I will look somewhere else for the error?

    This is the error:
    You have an error in your SQL syntax near 'date_recvd = '0000-00-00', last_name = 'ssssssss', first_name = 'aaaaaaaaaa' at line 3

    $sql = "UPDATE $table_name SET
    job_number = '$_POST[job_number]'
    date_recvd = '$_POST[date_recvd]',
    last_name = '$_POST[last_name]',
    first_name = '$_POST[first_name]',
    organizat = '$_POST[organizat]',
    assgn1 = '$_POST[assgn1]',
    assgn2 = '$_POST[assgn2]',
    assgn3 = '$_POST[assgn3]',
    date_due = '$_POST[date_due]',
    recvd_cao = '$_POST[recvd_cao]',
    rb_review = '$_POST[rb_review]',
    cost = '$_POST[cost]',
    status = '$_POST[status]',
    subject = '$_POST[subject]',
    letter_sent = '$_POST[letter_sent]',
    recvd_cao1 = '$_POST[recvd_cao1]',
    recvd_cao2 = '$_POST[recvd_cao2]',
    rb_rev1 = '$_POST[rb_rev1]',
    rb_rev2 = '$_POST[rb_rev2]',
    WHERE _id = '$_POST[_id]'";

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    missing a comma after
    job_number = '$_POST[job_number]' ,
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You forgot a comma to seperate the values job_number and date_recvd. It should be:

    Code:
     job_number = '$_POST[job_number]',
    date_recvd = '$_POST[date_recvd]',
    You ain't cleaning the incoming data? addslashes, mysql_escape_string, API functions could be helpful for you.

    EDIT: This round goes to firepages, leaving mordred behind in the dust...
    De gustibus non est disputandum.

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    hah , beat you by a whole minute ... ok I typed less
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •