Skip to content
Advertisement

Convert SQL results into PHP array

I’m fairly new to PHP and I’ve been looking around and can’t seem to find the specific answer I’m looking for.

I want to make a SQL query, such as this:

JavaScript

Basically I want to take the entire contents of the result and create an array that I can access in a similar fashion as the row. For example, if I have a field called ‘uid’ I want to be able to get that via myData[‘uid’]. I guess since there could be several rows, maybe something more like myData[0][‘uid’], myData[1][‘uid’], etc.

Any help would be appreciated.

Advertisement

Answer

You can do:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement