Re: HELP - Clean and simple

From: Date: Mon, 22 May 2006 14:26:21 +0000
Subject: Re: HELP - Clean and simple
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-236633@lists.php.net to get a copy of this message
On 5/22/06, Jonas Rosling <webmaster@gamearena.se> 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

« previous php.general (#236633) next »