Support Forums
Put the data from a MySQL column in an array - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Put the data from a MySQL column in an array (/showthread.php?tid=7508)



Put the data from a MySQL column in an array - RPicard - 05-31-2010

I'm basically looking to get the data from a specific column, only in rows where a condition is true, and put it into an array.

For example (it's a message system):

To.....Message....Subject
user1..example.....example
user2..example2....example

In this example I would want to put the subjects of the messages to user1 in an array.

Any ideas?


RE: Put the data from a MySQL column in an array - James - 06-01-2010

Using what driver?

http://php.net/manual/en/function.mysql-fetch-array.php
http://php.net/manual/en/function.mysql-fetch-assoc.php
http://php.net/manual/en/mysqli-result.fetch-assoc.php
http://php.net/manual/en/mysqli-result.fetch-array.php
http://php.net/manual/en/pdostatement.fetchall.php


RE: Put the data from a MySQL column in an array - RPicard - 06-01-2010

It looks like PDOStatement might be what I was looking for. I'll try it out later. Thanks.


RE: Put the data from a MySQL column in an array - RPicard - 06-01-2010

I ended up solving the issue with mysql_result() functions.