- Impact
- 9
This is a mysql function that allows you to find out how many rows there are in a specific table.
It requires only one parameter which tells it whats the mysql query.
I found it extreemly useful when making a flash and mysql and php driven site.
i hope you find it just as useful to you just like when i first found it.
However if you are looking for executing queries fast I would use:
That was a suggestion by NuPagady
It requires only one parameter which tells it whats the mysql query.
I found it extreemly useful when making a flash and mysql and php driven site.
PHP:
<?php
$link = mysql_connect("localhost", "root", "");//conect to db server
mysql_select_db("haco", $link);//select db
$result = mysql_query("SELECT * FROM projects", $link); //select the table
$num_rows = mysql_num_rows($result); //set variable
echo "total_rows=$num_rows"; //echo number of rows
?>
However if you are looking for executing queries fast I would use:
PHP:
<?php
$link = mysql_connect("localhost", "root", "");//conect to db server
mysql_select_db("haco", $link);//select db
$result = mysql_query("SELECT COUNT(*) FROM projects", $link); //select the table
echo "total_rows=$result"; //echo number of rows
?>
That was a suggestion by NuPagady
Last edited:




