A function should do one thing and do it well.
The function in question prints a table by querying a database. As such, it should handle the case where the database table has no rows to retrieve. Now, it might call other functions that handle some of its implementation details, one of which could be a function that counts the number of rows in the result set. However, this function already exists in the MySQL API, i.e., mysql_num_rows(). As such, you do not need to write another function for that task. If you do, it would have to query the database, resulting in an unnecessary query.