You can't set an array subscript using an array; it should be a numerical 
value or a string. 

What you want to do is 

$division[$div_id] = $array;

Better yet, try:

$divison[$div_id] = mysql_fetch_array($result, MYSQL_ASSOC);

J


Steve Buehler wrote:

> I am trying to learn some new things in the hopes that it would help me
> with my mysql/PHP programming.  The following code gives me an error: "
> Warning: Illegal offset type in z.php on line 25 ".
> 
> $result=mysql_query("SELECT * FROM division");
> while(($row=mysql_fetch_object($result))){
> $div_id=$row->div_id;
> $array=array("sub1" => $row->sub1,
>                  "sub1d" => $row->sub1d,
>                  "sub2" => $row->sub2,
>                  "sub2d" => $row->sub2d,
>                  "sub3" => $row->sub3,
>                  "sub3d" => $row->sub3d,
>                  "sub4" => $row->sub4,
>                  "sub4d" => $row->sub4d,
>                  "sub5" => $row->sub5,
>                  "sub5d" => $row->sub5d,
>                  "game_length" => $row->game_length);
> // The following is the line 25
> $division[$div_id][$array]=array();
> }
> 
> What I am trying to do is to be able to later call
> $division[$div_id][sub5]
> etc...  I sure hope that this can be done.  If not, I will just have to
> stick with temporary tables.
> 
> Thanks
> Steve


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

Reply via email to