Jump to content

If.... else for a MySQL query?


christo16

Recommended Posts

Ok this may be an easy one, if my query doesn't find anything how do I make it output some text. Example, so if my query below doesn't find what its looking for

$result = mysql_query('SELECT * FROM staffing WHERE date = "'.$variable.'"');
   		while ($row = mysql_fetch_array($result)) { 
                      echo 'Yay I found it!';                        }

and if it doesn't find anything output some text:

 echo 'Sorry I could not find it';

Thank you!

 

Link to comment
https://forums.phpfreaks.com/topic/39744-if-else-for-a-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.