-----Ursprungligt meddelande-----
Från: chris smith [mailto:[EMAIL PROTECTED]
Skickat: den 22 maj 2006 15:49
Till: Jonas Rosling
Kopia: PHP List
Ämne: Re: [PHP] HELP - Clean and simple


On 5/22/06, Jonas Rosling <[EMAIL PROTECTED]> wrote:
> I don't know if I'm explaining things in a difficult way or not. But I'm
> gonna try to explaine what I want very clean and simple.
>
> 1. I wan't to check if an array is decleard or not, refering to a value in
a
> row/field ($row[0])
> 2. If it's not decleard I declear it and assign it's name by the value
from
> a row/field ($row[0])
>         - Further down I shell fill it with values like
$arrayname[$row[2]] =
> $row[1] (arrayname based on $row[0])
> 3. Else if it's decleard fill it with values like above.
>
> Hope someone understands me.

And what code do you have so far? We're not going to write it for you.

:-) 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.

// Jonas

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

Reply via email to