CI - show database error or fail

血红的双手。 提交于 2019-11-29 17:42:11

You can use log_message and check the logs if the y behave as expected:

http://ellislab.com/codeigniter/user-guide/general/errors.html

I usually just use echo '<pre>'; print_r($query->result());die; just after the $query is formed. It's faster.

$this->db->where("email",$email);
$this->db->where("password",$password);
$query=$this->db->get("users");
echo $this->db->last_query();
die();

you can echo the query you just did by using $this->db->last_query() this will show the query that your made with the values, and check if the query is valid.

read more at http://ellislab.com/codeigniter/user-guide/database/helpers.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!