gpt4 book ai didi

php - 对数字函数行数的 fatal error 调用

转载 作者:行者123 更新时间:2023-11-29 20:57:20 26 4
gpt4 key购买 nike

public function email_check()
{
$this->form_validation->set_message('email_check', 'The %s '.$this->input->post('usr_email').' is already exist');
$this->db->where('usr_email', $this->input->post('usr_email'));
$query = $this->db->get('users');
if ($query->num_rows()>0)
return false;
else
return true;


}

( ! ) Fatal error: Call to a member function num_rows() on a non-object in C:\wamp\www\application\controllers\users.php on line 264

调用堆栈

#   Time    Memory  Function    Location
1 0.0005 266584 {main}( ) ..\index.php:0
2 0.0015 324704 require_once( 'C:\wamp\www\\system\core\CodeIgniter.php' ) ..\index.php:202
3 0.0440 4030256 call_user_func_array:{C:\wamp\www/\system\core\CodeIgniter.php:359} ( ) ..\CodeIgniter.php:359
4 0.0440 4031120 Users->save_registration( ) ..\CodeIgniter.php:359
5 0.0440 4044000 CI_Form_validation->run( ) ..\users.php:302
6 0.0450 4056264 CI_Form_validation->_execute( ) ..\Form_validation.php:341
7 0.0450 4057600 Users->email_check( ) ..\Form_validation.php:593

最佳答案

如果您想验证唯一的电子邮件地址。执行以下操作

$this->form_validation->set_rules('email', 'email', 'required|is_unique[tablename.fieldname]');

关于php - 对数字函数行数的 fatal error 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37522019/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com