Re: COUNT(*)

From: Date: Fri, 01 Aug 2003 08:39:05 +0000
Subject: Re: COUNT(*)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157904@lists.php.net to get a copy of this message
use mysql_fetch_rows(); $result="SELECT COUNT(*) FROM pet"; $sql=mysql_query($result); $number_of_rows = mysql_fetch_rows($sql); while ($row=mysql_fetch_array($sql)){ $pet_name=$row['pet_name']; echo ......; } Craig Roberts "Yury B ." <www@body-builders.org> wrote in message news:3F297220.27621.53D85F5@localhost... > Hi > > I used to use old fashioned mysql quieries but moderm mysql > apparently became more flexible so. I want to understand how to use > some of the new features like COUNT(*) > > Let's say I have > $result="SELECT COUNT(*) FROM pet"; > $sql=mysql_query($result); > while ($row=mysql_fetch_array($sql)){ > $pet_name=$row['pet_name']; > echo ......; > } > > the question is how do I actually retrieve the number of rows of sql > query result? > > Yury

« previous php.general (#157904) next »