confused: SQL UPDATE query

Discussion in 'Web Design and Development' started by jordanste, Aug 30, 2008.

  1. jordanste macrumors member

    Joined:
    Feb 25, 2006
    #1
    I am trying to create an "edit article" page and while im not exprecienced with sql i assumed this query would work, i get a successful query message but the row isnt actually updated in my database table, is there a syntax error with this query or does that look alright?

    Code:
    $query="UPDATE `main` SET `title`='$title', `body`='$body', WHERE `id`='$articleid'";
    mysql_query($query) or die('<p>Error, update query failed</p>');
     
  2. tyr2 macrumors 6502a

    tyr2

    Joined:
    May 6, 2006
    Location:
    Leeds, UK
    #2
    IIRC you shouldn't have a comma before the word 'WHERE'
     

Share This Page