Dynadot โ€” .com Registration $8.99

MySQL & PHP Question

Spaceship Spaceship
Watch

freeflow

Established Member
Impact
13
How can I make the "if" statement do something if the mysql query finds a result?

$sql = 'SELECT * FROM `Domains` WHERE `status` LIKE \'%delete%\';

if ($sql == ???) {

Do something;

}

Thanks for your help.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
PHP:
<?php
$query = mysql_query('SELECT * FROM `Domains` WHERE `status` LIKE \'%delete%\'');
if (mysql_num_rows($query) > 0) {
	# Do something
}
?>
 
Last edited:
0
•••
PHP:
$query = mysql_query("
        SELECT * 
        FROM Domains 
        WHERE status LIKE '%delete%'
"); 
if (mysql_num_rows($query) > 0) 
{ 
         while ($res = mysql_fetch_array($query))
         {
              // $res['something']...
         }
}
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back