Arrays -- How do I insert a pair of data into an array
| From: | Scott Walter | Date: | Thu, 22 Feb 2001 21:58:38 +0000 |
| Subject: | Arrays -- How do I insert a pair of data into an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41220@lists.php.net to get a copy of this message | ||
I am attempting to insert a set of data (actually a pair) into an array, without much success. I would like to insert the data set ("course number", "course title") into a numerically indexed array so that when I want to output the array I can reference it like so:
echo("$array[$i]["course_num"] $array[$i]["course_title"]");
// where $i is just the index value that increments
I tried building the array like so (where $tuple[....] is a valid result set from pg_fetch_row():
$array[] = array("course_num" => $tuple[crn],
"course_title" => $tuple[course_name]);
But all I gets outputted is:
Array["course_num"] Array["course_title"]
Any help with this would be greatly appreciated. Thanks.