Updating just a few colum values in a MySQL DB
Posted: Wed Sep 22, 2010 6:37 pm
I am getting the "Column count doesn't match value count at row 1" error, I that it is since I am only trying to update two vales in the DB.
My problem is I can't find how to update just the two vales and not the other 14?
This is what I want to do: (but it won't work)
In the past I have done things like this:
But wont this overwrite the existing values?
My problem is I can't find how to update just the two vales and not the other 14?
This is what I want to do: (but it won't work)
Code: Select all
mysql_query ("UPDATE generators
SET flag_status = 'on', flag_reason = '".pnVarPrepForStore($flag_reason)."'
WHERE generator_id ='$generator_id'")
or die (mysql_error());Code: Select all
mysql_query ("UPDATE generators
SET id = '', size = '', something = '', something_2 = '', flag_status = 'on', flag_reason = '".pnVarPrepForStore($flag_reason)."'
WHERE generator_id ='$generator_id'")
or die (mysql_error());