View Single Post
Old 05-15-2009, 08:17 PM   #6 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Depends on what you want to use the result for, just a check to see if the row was inserted for example bool is fine. However if you needed to check how many rows were updated, then use mysql_affected_rows.

For example, if you want to update all rows with id's between 8 and 9, but the table only holds 4 records, (thus only has id's 1-4) mysql_query will return true (i.e. mysql didnt explode), but mysql_num_rows will return 0.

In short, it depends on what you want to check for.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 05-15-2009 at 08:34 PM. Reason: corrected my bad engrish
sketchMedia is offline  
Reply With Quote