php / mysql update for multiple values in only one field?

ImmyGrant

New member
I have a table (say table name TBL fields FLD1, FLD2, FLD3) with existing data in it. I've recently added another field to it - FLD4. What I'm trying to do is to insert values into that new field only... for multiple records (about 1000). I'm trying to accomplish this with two arrays, but it's not working.
Here is what I'm doing...


in php:
arrrayOfValues = array();
arrayOfValuesToUpdate = array();
// Both arrays have values in them... they're both equal in length...

for($i=0; $i<count(arrayOfValues); $i++){
$result = myslq_query(UPDATE TBL SET FLD4='arrayOfValuesToUpdate[$i]' WHERE FLD1='arrayOfValues[$i]');
}
I'm not sure if that should even work for that many records...
Any ideas? :)
Thanks!
It also looks like the queries are correct.
From print $SQL:

UPDATE TBL SET FLD4 ='CEO' WHERE FLD1 ='11-1011.00'... etc etc... I've got about a thousand of those for each query, but db is not being updated. Hmmm...
Thanks for the answers so far... FLD1 is the primary key.
Nothing doing just yet... :)
Of course... problem solved :)
Ummm... the table name was misspelled :)

Thanks so much for your help!
 
Back
Top