Posted by Treefrog on 11/18/75 11:43
Alkimake wrote:
> if (mysql_num_rows($query)) {
> UPDATE....
> } else {
> INSERT
> }
>
> if ther is a record mysql_num_rows returns positive value.
Indeed, but which way is better?
Both methods will always involve two queries, but is it quicker to try
to UPDATE and fail (because of no rows) or SELECT and find 1 or 0, then
act upon it?
[Back to original message]
|