Re: mysql_num_rows
| From: | David Robley | Date: | Wed, 29 Nov 2000 07:18:41 +0000 |
| Subject: | Re: mysql_num_rows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27784@lists.php.net to get a copy of this message | ||
On Wed, 29 Nov 2000, Lauri Vain wrote:
> Hello,
> Please check out my code below. Yes, I know it's not very pretty at this stage
> but I need to deliver an example of how it'll work really soon (few hours).
>
>
> ******************************** SNIP ********************************
> $viewposts="SELECT * FROM kiba_trade_offer WHERE
> ((trade_messtype='parent')&&(trade_viewtype='public')";
> if($filter != ""){
> if($types != ""){
> if(($types == "buy")||($types == "sell")||($types ==
> "biz")){$viewposts .=
> "&&(trade_type='$types')";};
> };
> if($levels != ""){
> if(($levels == "public")||($levels == "agents")){$viewposts .=
> "&&(trade_viewtype='$levels')";};
> };
> };
>
> $viewposts .= ") ORDER BY trade_id DESC;";
>
> $results=mysql_query($viewposts);
> $loendur = mysql_num_rows($results);
> echo ("--- $numofrows ---");
Do you really mean
echo ("--- $loendur ---");
> while ($myrow = mysql_fetch_array($results)) { / . . . show the results . .
> . /}
> ******************************** SNIP ********************************
>
> Now, the while loop gives me five rows. What's wrong, the mysql_num_rows
> doesn't print anything, not even a zero?
>
>
> Thanks,
> Lauri Väin
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA