Re: Different results in function on PHP 4 and PHP 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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()) {
    $cid[] = $r['cid'];
   }

   foreach($cid as $value) {

<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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux