Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Outputs no of records in a tableCode Wizard, 12-30-2006 |
Outputs the number of records in a table
<?php
$db = mysql_connect("localhost","username","password");
mysql_select_db("database",$db);
$result = mysql_query("SELECT count(*) AS num FROM table",$db);
$num = mysql_result($result,0,"num");
if ($num == 1){
// if number of entries is more than 1
printf("<font color=red>%s</font>",$num); //prints number
}
// if number of entries is less than 1
else {
printf("<font color=red>%s</font>",$num); //print number
}
?>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

