Different results in function on PHP 4 and PHP 5

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

 



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) {
    $get_shops_by_cat = "SELECT * FROM 
ilp_eshop_zones,ilp_category_zone,ilp_region_zone WHERE 
ilp_category_zone.cid=ilp_eshop_zones.cid AND 
ilp_eshop_zones.cid='".$value."' AND ilp_region_zone.rid='".$region."' ORDER 
BY ilp_category_zone.category";
    $mysql->execute_query($get_shops_by_cat);

    if($mysql->numrows() <= 0) {
     //print "No eShops for the category";
    } else {
     while($r2 = $mysql->fetchrow()) {
      $eid = $r2['eid'];
      $category = $r2['category'];
      $name = $r2['name'];
      $conphrase = $r2['conphrase'];
      $description = $r2['description'];
      $rid = $r2['rid'];
      $flag = $r2['flag_locale'];
      $num = $mysql->numrows();

      if(!$l) {
       print "<h2><img 
src=\"images/flags/".$flag."\">&nbsp;".$category."</h2>\n";
       print "<form style=\" display: inline; margin-bottom: 0px;\" 
name=\"categories\"><a id=\"cat-paragraph\"><a id=\"cat\">".$name ." <font 
color=\"#CC0000\"><b>".$conphrase."</b></font>\n";
       print "<select name=\"region\" size=\"1\" 
onChange=\"location.href=document.categories.region.options[document.categories.region.selectedIndex].value\">\n";
       getRegion($mysql,$region,$eid,$_SERVER['PHP_SELF']);
       print "</select>\n";
       print "<input type=\"button\" value=\"Go!\" 
onClick=\"javascript:goTo(this.form.region);\">\n";
       print "<br>\n";
       print "<a id=\"desc\">".$description. 
"</a></i></p></form><br><br>\n";
       print "<HR color=#f0f8ff SIZE=1>";
       $l=$num-1;
      } else {
       print "<form style=\" display: inline; margin-bottom: 0px;\" 
name=\"categories\"><a id=\"cat-paragraph\"><a id=\"cat\">".$name ." <font 
color=\"#CC0000\"><b>".$conphrase."</b></font>\n";
       print "<select name=\"region\" size=\"1\" 
onChange=\"location.href=document.categories.region.options[document.categories.region.selectedIndex].value\">\n";
       getRegion($mysql,$region,$eid,$_SERVER['PHP_SELF']);
       print "</select>\n";
       print "<input type=\"button\" value=\"Go!\" 
onClick=\"javascript:goTo(this.form.region);\">\n";
       print "<br>\n";
       print "<a id=\"desc\">".$description. 
"</a></i></p></form><br><br>\n";
       print "<HR color=#f0f8ff SIZE=1>";
       $l--;
      }
     }
    }
   }
  }
}

If anyone can give me some pointers or point out probable reasons for this 
not working properly on PHP 5, then it would be much appreciated.

Best Regards,
Steve 

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