Re: Need help with arrays PLEASE!!!
| From: | Nasko Vassilev | Date: | Wed, 09 Apr 2003 08:48:20 +0000 |
| Subject: | Re: Need help with arrays PLEASE!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143028@lists.php.net to get a copy of this message | ||
If you use mysql_fetch_assoc() or for older vers. of PHP
myslq_fetch_array($result, MYSQL_ASSOC) you will end up with all your rows
in an array like that:
Row 1: $rows[0]["invoicenum"], $rows[0]["name"], $rows[0]["address"]
Row 2: $rows[1]["invoicenum"], $rows[1]["name"], $rows[1]["address"]
Row 3: $rows[2]["invoicenum"], $rows[2]["name"], $rows[2]["address"]
I'm not sure if that's exactly what you're trying to achieve, but that's the
way I'm usually pulling out data from a database
Cheers,
Nasko
"Bob Strasser" <bstrasser@telus.net> wrote in message
news:IOEJKJOCNENFMHGHJPPKMEBJCBAA.bstrasser@telus.net...
> I'mpulling multiple rows out of a MySQL database and inserting them into
> several arrays. After that I want to put all the arrays into one
> multi-dimensional array. Here is the code:
>
> while($row = mysql_fetch_row($mysql_result))
> {
> $invoicenum[] = $row[0];
> $name[] = $row[1];
> $address[] = $row[2];
> $city[] = $row[3];
> $state[] = $row[4];
> $zip[] = $row[5];
> }
>
> I want to put $invoicenum[], $name[], $address[], $city[], $state[],
$zip[]
> into 1 multi-dimensional array. Can anyone help me with this?
>