新手请教如何跟踪到model里面?
因为是新手,平时跟踪代码都是echo字符串出来然后判断问题在哪儿,现在的问题在调用model时,程序就没有下文,怀疑是数据插入错误,相关代码如下://model的代码
public function insertbuyer( $buyerinfo )
{
echo "8";
if ( $buyerinfo == FALSE )
{
return NULL;
}
echo "6";
//construct the
$this->db->insert('buyer',$buyerinfo);
}
//controller的代码
$this->load->model('Buyer_model');
if ( $type == 'buy')
{
echo "2";
var_dump($data);
$this->Buyer_model->insert_buyer( $data);
}
现在的结果是似乎$this->Buyer_model->insert_buyer( $data);没有生效,因为数据库没有对应的记录,以前使用过controller,但是当时只编写过view和controller,且系统已经搭建好了,只是基于上面做代码,没有遇到这么多问题,谢谢。
database.php db_debug为true时SQL执行错误会打印出来的。
或者model中 打印 $this->db->last_query();看看SQL 在控制器中加上
$this->output->enable_profiler(TRUE);
会显示所有信息,当然也有数据库相关的
页:
[1]