Re: Having a little trouble with Multi-Dimensional arrays
| From: | Richard Lynch | Date: | Thu, 04 Jan 2001 21:52:51 +0000 |
| Subject: | Re: Having a little trouble with Multi-Dimensional arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32739@lists.php.net to get a copy of this message | ||
> $sql3 = pg_exec($db, "select * from ref_directory where id =
> '$per[vir_dir_id]'");
> for ($pos=0;$pos<pg_numrows($sql3);$pos++) {
> $dir = pg_fetch_array($sql3,$pos);
>
> /* build array containg all matching dir names and ids */
>
> there are 3 fields in the database here
> id -- vir_dir_name -- parent_dir
echo $dir[0], $dir[1], $dir[2], "<BR>\n";
Or, if you want a 2-D array, use this:
$dir[] = pg_fetch_array($sql3, $pos);