RE: [PHP] update count
| From: | Jay Blanchard | Date: | Wed, 16 Jun 2004 13:46:46 +0000 |
| Subject: | RE: [PHP] update count | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-188393@lists.php.net to get a copy of this message | ||
[snip]
What is the best way to only do an update if it going to update only one
row?
I want to protect my code so that it won't accidentally update more than
one row.
I can do a select first but there must be an easier way. :-)
[/snip]
Do the update with conditions (this is a SQL question)
UPDATE
tblFOO SET bar = 'a_value' WHERE barID =
'227098762'
will only update the record(s) where barID is 227098762