Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

how does this php code where does the table db read happen

have the below code debugging and monitoring the $item variable then when it gets to
foreach ($this->items as $item) { the data is magically there but the de bug does not step off to the db read can some one please explain how this works

function initdata(){
<?php
//      $bbc = $user['id'];

      $curcatnum = -1;
      $itemnum = -1;
      $curcat = '';
      // THIS IS THE READ POINT

*********************************
      foreach ($this->items as $item) {
            $itemnum++;            
          if ($curcat != $item->category) {
                  $curcatnum++;
                  $itemnum = 0;
                     $curcat = $item->category;
                     echo ('price_list['.$curcatnum.'] = new Array();'."\n");
            };
            echo ("      price_list[".$curcatnum."][".$itemnum."] = ".$item->cost."; ");
      }
?>
0
sydneyguy
Asked:
sydneyguy
  • 3
  • 2
  • 2
  • +1
6 Solutions
 
Ray PaseurCommented:
Without seeing the actual code, it may be impossible to help, but I'll make a guess.  Since initdata() is a PHP function, it has its own variable scope.  Variable names inside the function are isolated from names outside the function.
0
 
Marco GasiFreelancerCommented:
Are you using some framework?
0
 
Ray PaseurCommented:
@marqusG: Based on the Zones, probably Joomla.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Marco GasiFreelancerCommented:
Lol, didn't see: it's written too little... :)
0
 
Chris StanyonCommented:
You've only shown part of the code so it's impossible to see. Something is happening before your code gets here to set the scope of $this

@Ray - it looks like the initdata() is a Javascript function - it's just using PHP to populate a Javascript array
0
 
Ray PaseurCommented:
initdata() is a Javascript function
Good probability.  So much is missing from the question that it's hard to discern what the real issue might be!
0
 
sydneyguyAuthor Commented:
sorry about that forgot yes its joomla 3 and yes there is some code missing this is the code that i am trying to figure out this would be the actual setup of the extraction of the db, this is the code that i cannot find, its not that i am holding any thing back intentionally i just cannot find the code were it sets up this array of data records, this is what i am trying to find,
 will step through the code now and see what i can come up with  
the module is com_ipricecalc if you have used that before
0
 
sydneyguyAuthor Commented:
thanks for the help
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now