FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Calculating number of rows

 


vignesh_natraj
my questions?
How do I calculate the number of rows in a MySQL table
How do i calculate the numbers of rows returned when i perform a query.
that's it for now.
hexkid
vignesh_natraj wrote:
How do I calculate the number of rows in a MySQL table

With the COUNT MySQL expression:
Code:
select count(*) from table;


vignesh_natraj wrote:
How do i calculate the numbers of rows returned when i perform a query.

With the mysql_num_rows() function
Code:
$sql = "select a, b, c, d from foobar where status=1";
$res = mysql_query($sql) or die('Error in query: ' . mysql_error());

$numrows = mysql_num_rows($res);
echo "Query returned $numrows rows.";

mysql_free_result($res);
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.