Re: Multidimensional arrays
| From: | Matt Matijevich | Date: | Fri, 18 Jul 2003 13:48:18 +0000 |
| Subject: | Re: Multidimensional arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155765@lists.php.net to get a copy of this message | ||
<snip>
select id, name from customer
redim custarray(recordcount,2)
i = 0
while not eof
custarray(i,0) = id;
custarray(i,1) = name;
i = i+1;
movenext
wend
</snip>
Not sure what kind of db you are using but I put this together using
postgresql using the manual. So this is untested.
$conn = pg_connect("host=localhost dbname=whatever");
$result = pg_exec($conn, "select id, name from customer");
$i = 0;
while ($row = pg_fetch_array($result))
{
$custarray[$i][0] = $row["id"];
$custarray[$i][1] = $row["name"];
$i++;
}