1) Count record:
//Connect to mysql server $link = mysql_connect(HOST, USER, PASSWORD); if(!$link) { die(\'Could not connect to server: \' . mysql_error());
Why not the let the DB do it - What about a simple
SELECT COUNT(*) FROM table WHERE abc=123;