Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Put the data from a MySQL column in an array
#1
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?
Robert Picard
http://www.rpicard.net
Reply
#2
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
Reply
#3
It looks like PDOStatement might be what I was looking for. I'll try it out later. Thanks.
Robert Picard
http://www.rpicard.net
Reply
#4
I ended up solving the issue with mysql_result() functions.
Robert Picard
http://www.rpicard.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is array and the the use of it?can someone explain to me? Advertise4you 2 1,086 10-30-2011, 02:13 PM
Last Post: ★Cooldude★
  optimize mysql through a php script andrewjs18 7 3,327 10-05-2011, 06:31 PM
Last Post: John.
  Creating a simple PHP/MySQL login script ndee 16 10,396 05-14-2011, 02:18 AM
Last Post: モrainee
  Simple MySQL Tutorial Sly 4 1,278 05-14-2011, 01:53 AM
Last Post: Sly
  PHP Echo HTML From MySQL Value? iMr 7 3,759 03-19-2011, 09:41 AM
Last Post: ★Cooldude★

Forum Jump:


Users browsing this thread: 2 Guest(s)