I was too tired, but a coffee and a c* and everything woks fine :)
Just forgot to init the array correctly !
At 19.04.2002  15:24, you wrote:
>
>Hi Folks,
>I have a problem assigning an 3dim array, maybe I´m to tired today to see the
>mistake, but PHP thinks, that it finds "Illegal string index" at the 
>marked line.
>could someone verify this, maybe find my mistake??
>FYI getDbAns(), talk2DB are substitutions for DB - related routines, and the
>produce the correct data.
>Sorry for the "overcommented" code, but I have syntax highlighting.
>TIA Oliver
>
>while( $res=$UDV -> getDbAns()) // fetch mains
>{
>     if(strlen($res[0]) > 2) // if result is OK
>     {
>        $menarr[$h]=$res[0]; // put them in array

should be $menarr[$h][0][0]=$res[0];

>        // get submenues
>        $selchi="select chi from link where pa = '$res[0]'";
>        $UDB ->  talk2DB($selchi);
>        while($chia=$UDB -> getDbAns())
>        {
>           if(strlen($chia[0]) >3) // if result is OK
>           {
>              //echo "<b>".$chia[0]."</b><br>";
>              // Youll get a <0x20> separated string
>              $subp=explode(" ",$chia[0]); // explode it, to get single values
>              if(is_array($subp)) // if there are more than one in it
>              {
>                 $maxs=count($subp); // check out how many
>                 for($n=0; $n < $maxs ; $n++)// each child in main/sub/n
>                 {
>                    // put the value in main/sub/n
>error here  ->   $menarr[$h][$s][$n]=$subp[$n];
>                 }
>              }
>              else // if there´s only one value
>              {
>                  $menarr[$h][$s][0]=$chia[0];
>              }
>           }// end if sub
>           $s++; // submenues plus one
>
>        }// end while subs
>     }// end if main
>
>     $h++; // mainmenues plus one
>}// end while mainmenues
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to