I was wondering how I would be able to query a SQL query and then put each line in a new array For example, a table might look like the following:
$ people = mysql_query ("choose from friends")
Output:
| ID | Name | Age - 1 ---- Tom ---- 32 - 2 ---- - Donation ---- 22 - 3 ---- Pat ---- 52 - 4 ---- Nick --- -32 - 5 ---- Dre ---- 65
How can I create a multi-dimensional array that works in the following ways, the first lines can be accessed by using the second column data People [0] [1] and the third column in the fifth line can be accessed using $ people [4] [2].
How do I create this type of array?
Sorry if this is a strange question, then I'm new to PHP + SQL and would like to know how to access data directly. Performance and speed are not a problem because I'm just writing short test scripts to catch up with the language.
$ rows = array (); While ($ line = mysql_fetch_array ($ result, MYSQL_NUM)) {$ rows [=] $ line; }
Comments
Post a Comment