Okay, total newbie when it comes to arrays, and I could really use some
help. I sure this will be an easy one for you veterans out there.

Here is the array ($code):
array(2) {
  ["total"]=>
  int(1)
  ["assign"]=>
  array(1) {
    [1]=>
    array(3) {
      ["type"]=>
      string(10) "Transcript"
      ["rows"]=>
      string(3) "603"
      ["codeapply"]=>
      array(1) {
        [1]=>
        array(3) {
          ["codeset"]=>
          string(23) "FFT 6 Level Code System"
          ["code_rows"]=>
          string(3) "302"
          ["code_complete"]=>
          string(1) "2"
        }
      }
    }
  }
}

Here is the output code:
        foreach ($this->code['assign'] as $assign => $details)
        {
            foreach ($assign['codeapply'] as $codeapply => $ca_details)
            {
            echo "<tr>";
            echo    "<td>";
            echo        $details['type']." ".$assign;
            echo        "</a>";
            echo    "</td>";
            echo    "<td>";
            echo        $ca_details['codeset'];
            echo    "</td>";
            echo    "<td>";
            echo
$ca_details['code_complete']."/".$ca_details['code_rows']." Items Coded";
            echo    "</td>";
            echo    "<td>";
            printf      (" %.0d%%",
($ca_details['code_complete']/$ca_details['code_rows'])*100);
            echo    "</td>";
            echo "</tr>";
            }
        }

Output error:
Warning: Cannot use a scalar value as an array
Warning: Invalid argument supplied for foreach()

Conceptually and practically I have been struggling with how to navigate
levels of the arrays which are defined by a variable (e.g.
$code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for the
codeapply ID on the assign ID).

Thanks in advance!

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

Reply via email to