duanmengmiezen8855 2018-10-16 05:24
浏览 75
已采纳

查询返回错误的数组codeigniter

I am trying to get the data from db Here is the query

     public function updating($id)
    {
        $uquery=$this->db->query(' SELECT * FROM `form` WHERE id='.$id);
        print_r($uquery);
        //return $request_data;

    }

But instead of returning an array it's returning this:

CI_DB_mysqli_result Object ( [conn_id] => mysqli Object ( [affected_rows] => 1 [client_info] => mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $ [client_version] => 50012 [connect_errno] => 0 [connect_error] => [errno] => 0 [error] => [error_list] => Array ( ) [field_count] => 6 [host_info] => localhost via TCP/IP [info] => [insert_id] => 0 [server_info] => 5.5.5-10.1.16-MariaDB [server_version] => 50505 [stat] => Uptime: 250329 Threads: 1 Questions: 4886 Slow queries: 0 Opens: 40 Flush tables: 1 Open tables: 29 Queries per second avg: 0.019 [sqlstate] => 00000 [protocol_version] => 10 [thread_id] => 353 [warning_count] => 0 ) [result_id] => mysqli_result Object ( [current_field] => 0 [field_count] => 6 [lengths] => [num_rows] => 1 [type] => 0 ) [result_array] => Array ( ) [result_object] => Array ( ) [custom_result_object] => Array ( ) [current_row] => 0 [num_rows] => [row_data] => )

Why this string is coming?

  • 写回答

2条回答 默认 最新

  • dtr32221 2018-10-16 05:26
    关注

    Use result_array();

    public function updating($id)
        {
            $uquery=$this->db->query(' SELECT * FROM `form` WHERE id='.$id);
            $array =$uquery->result_array();
            print_r($array);
    
    
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 电脑出问题了,说是usbmom注册表没
  • ¥20 需要步骤截图(标签-服务器|关键词-map)
  • ¥50 gki vendor hook
  • ¥15 灰狼算法和蚁群算法如何结合
  • ¥15 这是一个利用ESP32自带按键和LED控制的录像代码,编译过程出现问题,请解决并且指出错误,指导如何处理 ,协助完成代码并上传代码
  • ¥20 stm32f103,hal库 hal_usart_receive函数接收不到数据。
  • ¥20 求结果和代码,sas利用OPTEX程序和D-efficiency生成正交集
  • ¥50 adb连接不到手机是怎么回事?
  • ¥20 抓取数据时发生错误: get_mooncake_data() missing 1 required positional argument: 'driver'的问题,怎么改出正确的爬虫代码?
  • ¥15 vs2022无法联网