in reply to skip empty mysql table

You can check for zero rows with:

SELECT count(*) from TABLE