If I have mysql table foo with fields a, b, c, d with multiple records and a being the primary key. Record 1 has the following data: a = 1, b = true, c = val1a, d = val2a. If I want to access the data using php, I do:
$result = mysql_query("SELECT * FROM foo WHERE a = '1'");
$rec = mysql_fetch_array($result);
To change b and c, I would do:
mysql_query("INSERT INTO foo (b,c) VALUES (false,'newval') WHERE a = '1'");
Is there a way to write the whole record without listing all the fields (a,b,c,d)?
What I would like to do is write the whole $rec back to table foo:
$rec['b'] = false;
$rec['c'] = 'newval';
mysql_query("INSERT INTO foo $rec");
I know I could do a foreach and build the whole insert, but is there already a php function that does what I am tryng to accomplish?