FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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);
Related topics
Calculating FormattedCurrency
Creating a new Operating System
useless posts
Implementing your database access in PHP as a layer.
Frankfurt Motor Show, 2005
Buying 6, 7 or 8 ICQ number
mysql/php help please
HTML tables with irregular rows and/or columns
how can i make a php script for enter username and password?
list number of rows in a table
Deleting duplicate rows in mysql
select x random rows from database
SQL - length of a number (number of digits)
A variable number of inputs for PHP to insert MYSQL
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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