Community Forums 

Main Content

    Apr 01 2012 15:27:41



    Join date : 2008-09-18      Posts : 488

    With that much code, it is tough to tell just by looking at it (and we don't know the contents of products_variables.php).

    Some general advice: Add print_r and echo debug statements to your code to check variable values and logic conditions. That should lead you to your problem.

    Hint: If you use print_r to look at array values, make a function like this to make the output more readable:
    function print_debug($var, $name=null) {
    echo("<br />");
    if(!empty($name)) echo("$" . $name . ":\r");

    Apr 01 2012 18:29:18



    Join date : 2008-09-18      Posts : 488

    Say you want to see the value of $scount in your loop. You would add the line:

    echo("scount=" . $scount . "<br />");

    inside your loop. Upload the page, then browse to it. You will see the value of scount each time it increments.

    If you want to see the value of an array, like $searchrow, you would use the function I gave you and add the line:

    print_debug($searchrow, "searchrow");

    to your script inside the loop.

    BTW, I don't see where you are running a query to populate the mysql result set $searchresult. It may be in populated in product_variables.php. If not, that may be your problem. Although your for statement should throw an error if $searchresult isn't a valid mysql result set.

    May 12 2012 14:48:27



    Join date : 2008-09-18      Posts : 488