I'm looking for a reasonably simple and fast way to fill an array with the results of a single column select query.
example results from query:
+-----------+
| productid |
+-----------+
| PS |
| PSLEB |
| MD1 |
| CPSS1 |
| CPSG1 |
| CPSP1 |
| CPSSR |
| CPSGR |
| ST1 |
| STFREE |
+-----------+
desired array:
$arr = array(PS,PSLEB,MD1,CPSS1,CPSG1,CPSSR,CPSGR,ST1,STFREE);
I'm using MySQL.
I've seen ways to fill an array with an entire single row. But I only need one value from each row so mysql_query() and mysql_fetch_array() seem like overkill. Does anyone have a function that might do this already or a suggestion to get me started?
Ultimate Goal:
Basically, I want to interate through a set of ID's returned by the select query and perform further querys based on each id in the result. An array would be a clean way to step through it. If there is a
better/simpler/easier way to do this, please let me know. I'm new to PHP
(but not programming).
Thanks a bunch,
Glenn