Counting records in PHP/mySQL
by Scud Wednesday, July 04, 2007
Rating:
Vote this news:
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.
<?php
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;
?>



