Two questions:
Upon opening a resultset with MySQL, how do you populate a two dimensional array, let's say with:
CustomerName CustomerID
How you create as above, but using an associated array?
Any Help please.
Many Thanks
You can get at associative array using the mysql_fetch_array() function. It will return an array that has the column names as the key of the key/value pair.
The easiest way to populate it is:
while ($data[]=mysql_fetch_assoc($res)) { // nothing 🙂 }
and that will fill $data up with a multidimensional array of everything in the result, and in 2 lines of code (and 1 comment 🙂)
Dave