[advanced search]
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Webmaster Tutorials
User Name
Password

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: 805
NP$: 1406.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

Last edited by asgsoft : 03-04-2006 at 01:48 PM. Reason: adding an extra suggestion by NuPagady
asgsoft is offline   Reply With Quote
Old 03-04-2006, 01:45 PM   · #2
NuPagady
NamePros Regular
 
NuPagady's Avatar
 
Name: Paul
Location: Lithuania
Trader Rating: (4)
Join Date: Jul 2005
Posts: 473
NP$: 42.43 (Donate)
NuPagady is on a distinguished road
Yes, that would work. However, I think "SELECT COUNT(*) FROM projects" query would work faster.
NuPagady is offline   Reply With Quote
Old 03-04-2006, 01:46 PM   · #3
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 805
NP$: 1406.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
thanks for the suggestion. I will add it too.
asgsoft is offline   Reply With Quote
Old 03-06-2006, 03:46 AM   · #4
J4m!3
NamePros Regular
 
J4m!3's Avatar
 
Name: Jamie
Location: Clevedon, UK
Trader Rating: (9)
Join Date: Oct 2005
Posts: 198
NP$: 25.00 (Donate)
J4m!3 will become famous soon enoughJ4m!3 will become famous soon enough
Got to agree
J4m!3 is offline   Reply With Quote
Old 03-06-2006, 04:13 AM   · #5
JuggernautH
Account Closed
 
JuggernautH's Avatar
 
Name: Christian Eklund
Location: ../home/mysite
Trader Rating: (87)
Join Date: Dec 2005
Posts: 3,613
NP$: 3.00 (Donate)
JuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud ofJuggernautH has much to be proud of
Cancer Child Abuse
Thnx for the helpfull information, i used to code php and that stuff before, but i havent done so in about 1.5 years
JuggernautH is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
http://www.internetinvestments.com/ http://www.mobisitetrader.com/ Custom Logo Design
Advertise your business at NamePros
All times are GMT -7. The time now is 04:41 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0