The result of a query is the resource identifier. So no, it does not contain the array.
With the *_fetch_array, *_fetch_row and *_fetch_object you tell the *sql server to give you one row of the result set.
So, as far as I know, you have to use the above function to iterate through the resulting rows.
If you write a function that runs the query, you can let it return an array of the result.
This code returns an array of records that matched the query. You can move data around as you like.
It's universal if all your tables have a column 'id'. My tables usually don't as I get confused when I start joining tables, so I have something like id_table1, id_table2 etc. So I write a function like this for every table.
Please note that I use result in a different way than you do.
PS code not tested, just to give you the basic idea.