codeigniter错误,从表中选择数据 [英] codeigniter error with selecting data from table
本文介绍了codeigniter错误,从表中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法弄清楚我的模型出了什么问题,它说出现了一个致命错误。
I cant figure out whats wrong with my model, it said a Fatal Error occured.
这是我的模型文件:
function getName($no_ktp){
$this->db->select('nama')->from('dt_prbd')->where('no_ktp', $no_ktp);
$qry_getName = $this->db->get();
if ($qry_getName->num_rows() > 0) {
foreach ($qry_getName->result() as $data_getName){
$hasil_qry_getName[] = $data_getName;
}
return $hasil_qry_getName;
}
}
我遇到这个错误。
Fatal error: Call to a member function num_rows() on boolean in C:\xampp\[APP_PATH]\M_hrd_apps.php on line 25
我认为错误在查询中,所以我把它改成:
I thought the error is in the query, so I changed it into this:
$qry_getName =
$this->db->select('nama')
->from('dt_prbd')
->where('no_ktp', $no_ktp)
->get();
但错误是一样的,
Call to a member function num_rows() on boolean
任何人帮助我。
推荐答案
所有问题解决,代码中没有错误。我尝试重新创建数据库,然后所有的脚本转换成我想要的。
all problem solved, there is no error in code. i try to re-create the db, and then all script turn out like what i expect.
感谢所有的帮助 Deep Parekh 和 Abdulla
这篇关于codeigniter错误,从表中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文