confused: SQL UPDATE query

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

  1. jordanste macrumors member

    Feb 25, 2006
    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?

    $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


    May 6, 2006
    Leeds, UK
    IIRC you shouldn't have a comma before the word 'WHERE'

Share This Page