将数据的主键值作为关联数组的索引来获取数据
王林
王林 2023-07-16 17:41:35
[PHP讨论组]

在执行获取查询后,我得到了一个结果数组:

[row_choice] => Array
  (
    [0] => Array
      (
        [id] => 277410
        [text_value] => Two Wheel
      )
    [1] => Array
      (
        [id] => 277411
        [text_value] => Three Wheel
      )
    [2] => Array
      (
        [id] => 277412
        [text_value] => Four Wheel
      )
  )

我如何获得这样的结果数组?

[row_choice] => Array
  (
    [277410] => Array
      (
        [id] => 277410
        [text_value] => Two Wheel
      )
    [277411] => Array
      (
        [id] => 277411
        [text_value] => Three Wheel
      )
    [277412] => Array
      (
        [id] => 277412
        [text_value] => Four Wheel
      )
  )

我应该怎么做?

我的问题是

SELECT id,text_value FROM answer_choice


王林
王林

有朋自远方来,虽远必诛!

全部回复(2)
P粉137498044

王林老师,就是我现在遇到一个weblogic在容器运行的问题,刚刚看了您写的weblogic,但是我的没弄好,真的很需要帮助一下,能加我微信1468697304吗,谢谢拉

coco

王老师你好,对你的技术非常认同,很希望和你有进一步的交流机会,方便加个微信或邮件吗

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号