Re: HELP - Clean and simple

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/22/06, Jonas Rosling <webmaster@xxxxxxxxxxxx> wrote:
:-) Sorry! I've been digging with this for a while now so I don't think I
have the best code left. But this is what I have for the moment:

while($row=mysql_fetch_array($result)) {

        if (!$$row[0]) {

                $$row[0] = array();

                $$row[0][$row[2]] = $row[1];

        }

        else {

                $$row[0][$row[2]] = $row[1];

        }

}

I've been trying with eval() a bit as well without any good result.

The above code will work properly if you surround the
dynamic variable names by curly brackets:

   ${$row[0]}[$row[2]] = $row[1];

Rabin

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux