当我尝试print_r mysql_fetch_array的sql查询时,我得到了这个结果。
Array
(
[0] => 1
[id] => 1
[1] => 2011
[publish_date] => 2011
[2] => Posted
[status] => Posted
[3] => test
[post_title] => test
[4] => testy test test testtttttt
[post_text] => testy test test testtttttt
[5] => true
[post_comments] => true
[6] => 21
[reviews] => 21
[7] => 1
[network_id] => 1
[8] => 3
[views] => 3
[9] => 0
[comments] => 0
)
我想要的只是字符串数组键,那么如何将此结果转换为?
Array
(
[id] => 1
[publish_date] => 2011
[status] => Posted
[post_title] => test
[post_text] => testy test test testtttttt
[post_comments] => true
[reviews] => 21
[network_id] => 1
[views] => 3
[comments] => 0
)
答案 0 :(得分:5)
答案 1 :(得分:2)
而不是mysql_fetch_array使用mysql_fetch_assoc。 就是这样。
答案 2 :(得分:0)