1) Count record:
//Connect to mysql server $link = mysql_connect(HOST, USER, PASSWORD); if(!$link) { die(\'Could not connect to server: \' . mysql_error());
mysql has a count function:
http://dev.mysql.com/doc/refman/5.1/en/counting-rows.html
so you could use:
SELECT COUNT(*) FROM table WHERE abc=123
or whatever condition.