Adsense
Popular Posts
- Amazon web serive
- increase mysql query speed
- MySQL workbench -"Could not decrypt password cache"
- git svn conversion
- Unix Utils and wget in Windows
- add comment to table columns in phpMyAdmin
- deposit cheque in TD bank using Mobile phone
- Setup vi syntax for PHP
- Special characters pronunciation link
- Get WAMP running on EC2
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