This function returns always 1 (TRUE), maybe there are better options to find out if the table is empty?
function isEmpty($tableName) { $sql = "SELECT * FROM $tableName"; $q = mysql_query($sql); if (mysql_num_rows==0) { return TRUE; } else { return FALSE; } } echo isEmpty("mytable");