Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
Tuesday, January 28, 2014
check if MySQL return result in PHP using mysql_num_rows
In PHP, I have following query to check if userid exist
$result = mysql_query("SELECT USERID, FIRSTNAME, LASTNAME FROM USERS WHERE USERID=".$userid);
if userid exists,
if (mysql_num_rows($result)>0) {echo "user already in database";}
Here PHP function mysql_num_rows is used to get how many rows returned from MySQL query.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment