Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2007
    Posts
    26

    Unanswered: updating multiple field in 1 table

    trying to update multiple fields in the same table, i think I have a syntax error...anyone know the answer?
    thanks much in advance!

    code im using is:

    $reflect_change = "UPDATE user_movements SET logged_in = '$user_',changed_status = '$new_status',jobID ='$status_ids'";
    mysql_query($reflect_change);

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    You might be fortunate that it is not working, because without a WHERE clause to limit which records get updated, all of your records would get changed to the same set of values.

    To get mysql to tell you why the query is not working, add a little error reporting to your code -
    PHP Code:
    mysql_query($reflect_change) or die('UPDATE failed: ' mysql_error()); 

  3. #3
    Join Date
    Mar 2007
    Posts
    26

    ok

    thanks for the tip!... I knew about the where clause.. but i was trying to
    get around it..i guess thats not possible? right?

  4. #4
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    If you don't have a WHERE clause, the query will operate on all rows in your database. For a DELETE or UPDATE query, it would delete or change all rows.

  5. #5
    Join Date
    Mar 2007
    Posts
    26

    ok

    thanks!...

Posting Permissions

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