SV: [PHP] HELP - Clean and simple
| From: | Jonas Rosling | Date: | Mon, 22 May 2006 13:59:04 +0000 |
| Subject: | SV: [PHP] HELP - Clean and simple | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236632@lists.php.net to get a copy of this message | ||
-----Ursprungligt meddelande-----
Från: chris smith [mailto:dmagick@gmail.com]
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 <webmaster@gamearena.se> 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