Counting records in PHP mySQL

posted by editor date: Thursday, May 22, 2008 category: PHP
  Featured Story | Printable View | Email It | Comments | Write Comment

Following code samples, demonstrates how to count records in a MySQL database table. You may send parameters to query to display only selected range of rows.


mysql_pconnect($server, $username, $password);
mysql_select_db("articles_index") or die("Can not find database");

$query = "select * from articles where catID = 4";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
$count = $row["count"];
}
echo $count;

?>


Custom Search



Gazatem Technologies Active News Manager


page counter

Listed with 411asp.net
Listed with 4aspin.com
PHP, ASP, .NET, JSP Resources, Reviews