Displaying mysql results as an object?

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-04-09T07:26:46Z Indexed on 2010/04/09 7:33 UTC
Read the original article Hit count: 260

Filed under:
|
|
|
|

If I have a database with the structure:

___id_____|____value____
   1      |    value1
   2      |    value2
   3      |    value3

How can I pull data from this MySQL database in PHP and have it formatted like this:

Array ( [0] => stdClass Object ( [id] => 1 [value] => value1 ) [1] => stdClass Object ( [id] => 2 [value] => value2 ) [2] => stdClass Object ( [id] => 3 [value] => value3 ) )

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql