<?mysql_pconnect('HOST', 'USER', 'PASS');mysql_select_db('DB');mysql_query("SET NAMES 'utf8'"); $per_page=6; $result = mysql_query('SELECT COUNT(id) FROM photos');$count= mysql_result($result, 0);?>