If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > updating multiple field in 1 table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-07, 23:26
john_cmd john_cmd is offline
Registered User
 
Join Date: Mar 2007
Posts: 26
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);
Reply With Quote
  #2 (permalink)  
Old 05-14-07, 23:39
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
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()); 
Reply With Quote
  #3 (permalink)  
Old 05-15-07, 00:12
john_cmd john_cmd is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 05-15-07, 00:56
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
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.
Reply With Quote
  #5 (permalink)  
Old 05-15-07, 12:25
john_cmd john_cmd is offline
Registered User
 
Join Date: Mar 2007
Posts: 26
ok

thanks!...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On