Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Setup vi syntax for PHP
- git svn conversion
- increase mysql query speed
- Unix Utils and wget in Windows
- Amazon web serive
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