脚本宝典收集整理的这篇文章主要介绍了php – CodeIgniter – 调用非对象上的成员函数select(),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
class User_model extends CI_Model { function validate_user() { $this->db->select('*'); $this->db->From('user'); $this->db->where('username',$this->input->post('username')); $this->db->where('password',md5($this->input->post('password'))); $validate_user = $this->db->get(); if($validate_user->num_rows == 1) { return TRUE; } } }
Call to a member function select() on a non-object
目前我使用CodeIgniter版本2.1.0.请帮帮我!
$autoload['libraries'] = array('database','session');
或在你的类构造函数中:
class User_model extends CI_Model { public function __construct() { parent::__construct(); $this->load->database(); } }
您可以在这里获得更多信息:http://ellislab.com/codeigniter/user_guide/database/connecting.html
以上是脚本宝典为你收集整理的php – CodeIgniter – 调用非对象上的成员函数select()全部内容,希望文章能够帮你解决php – CodeIgniter – 调用非对象上的成员函数select()所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。