使用 PHP 修改查询结果以返回更可用的数组
嘿大家, 我有一个查询结果作为带有活动记录的数组返回:
Array (
[0] => Array ( [name] => Betty Glassmaker )
[1] => Array ( [name] => John Johnson )
[2] => Array ( [name] => Bill Pratt )
)
但由于我的查询专门只要求名称列,我宁愿修改结果以反映此数组结构:
Array (
[0] => Betty Glassmaker
[2] => John Johnson
[3] => Bill Pratt
)
什么可能是获取结果的最简单方法我'我在找什么?
Hey everyone,
I have a query result returned as an array with active record:
Array (
[0] => Array ( [name] => Betty Glassmaker )
[1] => Array ( [name] => John Johnson )
[2] => Array ( [name] => Bill Pratt )
)
But since my query specifically only asks for the name column, I would rather the results be modified to reflect this array structure:
Array (
[0] => Betty Glassmaker
[2] => John Johnson
[3] => Bill Pratt
)
What might be the easiest way to get the result I'm looking for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以循环遍历你的数组,像这样(未经测试)
祝你好运!
You could loop through your array, something like this ( not tested )
Good-luck!