Jump to content

[SOLVED] What would be the code for this?


ballhogjoni

Recommended Posts

I am connecting to my DB table and then exporting that table info to excel. My question is, is there a function that will let me know if there are no records in my table? Something like

 

$no_records = mysql_num_rows($sql=0)

if ($no_records=0) {

echo "You have No Records";

}

Link to comment
https://forums.phpfreaks.com/topic/57573-solved-what-would-be-the-code-for-this/
Share on other sites

This is the code I have:

 

if (!mysql_num_rows($sql)) {

echo "You have No Records";

}

 

But I get this warning and the code still executes:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 16

You have No Records

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.