View Single Post
Old 03-04-2006, 01:27 PM   · #1
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 810
NP$: 985.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
mysql_num_rows()

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.

PHP Code:
<?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

?>

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:

PHP Code:
<?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


Please register or log-in into NamePros to hide ads
asgsoft is online now   Reply With Quote
Site Sponsors
EscrowDNS Domain Tasting Buy Flash Arcade Game Script
Advertise your business at NamePros
All times are GMT -7. The time now is 04:44 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.