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 ) )
You can use the mysql_fetch_object() function instead of mysql_fetch_array() and manually create new objects.
Read more about it here: http://php.net/manual/en/function.mysql-fetch-object.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.