Re: mysql_num_rows

From: Date: Wed, 29 Nov 2000 08:26:17 +0000
Subject: Re: mysql_num_rows
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27790@lists.php.net to get a copy of this message
I didn't have a chance to really examine the script, but for starters remove the semicolons after the wrappers in your if / else statements. Right now you have if(whatever()) { print ("no no"); }; <-- it should be just } if(whatever()) { print ("no no"); } Secondly, I don't think that && is a valid operator in a mySQL query. I could be incorrect though. ----- Original Message ----- From: Lauri Vain <optima@hot.ee> To: PHP <php-general@lists.php.net> Sent: Wednesday, November 29, 2000 12:09 AM Subject: [PHP] mysql_num_rows 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 ---"); 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#27790) next »