As far as performance does it matter which way I do this?
I have an array of ID's (could be around 20-50) that I pass to a function to UPDATE each ROW in a TABLE of that ID.
I am using ADODB and thought it would be best to do something like this:
Code: Select all
$DB->StartTrans();
for ($i = 0; $i < count($theIdList); $i++) {
$this->database->Execute("UPDATE mytable SET val1 = $i WHERE id = $theIdList[$i]");
}
$DB->CompleteTrans();So, I removed the transaction stuff and just started doing it this way:
Code: Select all
for ($i = 0; $i < count($theIdList); $i++) {
$this->database->Execute("UPDATE mytable SET val1 = $i WHERE id = $theIdList[$i]");
}Is this a bad thing to do? Should I be worried about this or is this a normal thing? Or is there a better way?
Thanks!!