Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法按id打印数据_Php_Codeigniter 3 - Fatal编程技术网

Php 无法按id打印数据

Php 无法按id打印数据,php,codeigniter-3,Php,Codeigniter 3,这是我的问题。我正在尝试从id获取chat_并代表它获取数据。 但是这个查询返回所有数据 如果有任何想法,请告诉我 $chatfrom = $this->input->post('chat_from'); $this->db->select('chat_id,chat_from,message,created_date',$chatfrom); $userchatData = $this->db->get($this->db->dbprefix('

这是我的问题。我正在尝试从id获取chat_并代表它获取数据。 但是这个查询返回所有数据

如果有任何想法,请告诉我

$chatfrom = $this->input->post('chat_from');
$this->db->select('chat_id,chat_from,message,created_date',$chatfrom);
$userchatData = $this->db->get($this->db->dbprefix('usres_chat'))->result_array();
希望这将帮助您:

查询中缺少where子句,并从select中删除第二个参数

应该是这样的

$chatfrom = $this->input->post('chat_from');
$this->db->select('chat_id,chat_from,message,created_date');

/*replace `chat_from` with your table column name if it is not */

$this->db->where('chat_from',$chatfrom);
$userchatData = $this->db->get($this->db->dbprefix('usres_chat'))->result_array();

更多信息:

where子句如何?查询中没有where子句。