Solved

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

Posted on 2013-11-23
8
297 Views
Last Modified: 2013-11-24
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
Comment
Question by:sydneyguy
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 300 total points
Comment Utility
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
 
LVL 30

Assisted Solution

by:Marco Gasi
Marco Gasi earned 100 total points
Comment Utility
Are you using some framework?
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 300 total points
Comment Utility
@marqusG: Based on the Zones, probably Joomla.
0
 
LVL 30

Assisted Solution

by:Marco Gasi
Marco Gasi earned 100 total points
Comment Utility
Lol, didn't see: it's written too little... :)
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 100 total points
Comment Utility
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
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 300 total points
Comment Utility
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
 

Author Comment

by:sydneyguy
Comment Utility
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
 

Author Closing Comment

by:sydneyguy
Comment Utility
thanks for the help
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now