SELECT count(*) FROM table #### SELECT * FROM table ORDER BY id LIMIT $rand, 1