Re: Different results in function on PHP 4 and PHP 5
| From: | Chris | Date: | Wed, 01 Mar 2006 00:27:57 +0000 |
| Subject: | Re: Different results in function on PHP 4 and PHP 5 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231249@lists.php.net to get a copy of this message | ||
Stephen Lake wrote:
Good Afternoon Folks, After pounding my head into the ground for days over a problem I am having, I decided to post here to see what you guys and girls think. I have a user defined function that outputs categories from a database and assosiated eShops. Now in PHP 4 this is working perfectly however my client has PHP 5, and the function is only outputting the first eshop for each category. How can I get this working properly in PHP 5? Below is the function in question: function getAllCategories($mysql,$region) { $cat_list = "SELECT * FROM ilp_category_zone ORDER BY category"; $mysql->execute_query($cat_list); if($mysql->numrows() <= 0) { print "There are currently no categories"; } else { while($r = $mysql->fetchrow()) {<snip> Try that as foreach($cid as $cidpos => $value) { Does $cid actually have all the values that it should? echo sizeof($cid); just before the foreach. -- Postgresql & php tutorials http://www.designmagick.com/$cid[] = $r['cid'];} foreach($cid as $value) {