Showing how many rows in a table?

A

Anonymous

Guest
Here is the code I am trying to use to print the number of rows that are in a table, but as you are probably laughing right now, you can see that it isn't working... any help will be most appreciated.

<?php
include_once "ez_sql.php";
$query = dbase_numrecords
$result = mysql_query ($query);
print ("$result");
?>
 
Code:
 <?php

$query = mysql_query("SELECT *FROM `sometable`")
$numrows=mysql_num_rows($query);
echo $numrows;

 ?>

another solution

Code:
$query = "select count(*) from base";
$r=mysql_db_query($database,"$query");
$count = mysql_result($r,0,"count(*)");
 
This is the final functional code:
Code:
    <?php
    include_once "ez_sql.php";
    $result = mysql_query("SELECT * FROM quickinfo");
    $num_rows = mysql_num_rows($result);
    echo "$num_rows Customers\n";
    ?>
 
Back
Top