PHP array count?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

PHP array count?

Post by mzfp2 »

hi

im using mysql_fetch_array to get rows of a result array, however how can i count how many rows were returned without having to pasds a seperate count query to mysql?

thanks
M
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

DeGauss
Forum Contributor
Posts: 105
Joined: Tue Oct 22, 2002 9:44 am
Location: Gainesville, FL

Post by DeGauss »

or:

$blah=mysql_fetch_array($sql)
$number=count($blah);
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$blah=mysql_fetch_array($sql)
$number=count($blah);
counts how many fields one row has.
Use the function hob_goblin pointed you to.
DeGauss
Forum Contributor
Posts: 105
Joined: Tue Oct 22, 2002 9:44 am
Location: Gainesville, FL

Post by DeGauss »

Oops, yeah.

Sorry!
Post Reply