MySQL Database & Model Classes
View Single Post
05-15-2009, 08:17 PM
Join Date: Oct 2007
Location: Manchester, UK
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
. Reason: corrected my bad engrish
View Public Profile
Send a private message to sketchMedia
Visit sketchMedia's homepage!
Find More Posts by sketchMedia