错误消息:调用未定义的方法 CI_DB_mysqli_result::results()
Error Message: Call to undefined method CI_DB_mysqli_result::results()
我是 CodeIgniter 的新手,在连接数据库后遇到以下错误。如果有人能帮助我,那真是太好了。我在 Whosebug 中查看了之前的答案,但 none 帮助了我。
控制器代码如下
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends MY_Controller {
public function index() {
$this->load->view('home');
}
public function adminRegister() {
//loading teh queries model
$this->load->model('queries');
//Calling the getRoles function inside the roles
$roles = $this->queries->getRoles();
print_r($roles);
exit();
$this->load->view('register');
}
public function login() {
echo 'login';
}
}
型号代码
<?php
//Details of queries whicha re used to interact with teh database
class Queries extends CI_Model {
//Created a function with the name getRoles
public function getRoles() {
//Fetch the reocrds from the table
$roles = $this->db->get('tbl_roles');
if ($roles->num_rows() > 0) {
return $roles->results();
}
}
}
?>
目前没有使用来自控制器的数据。任何帮助将不胜感激。提前致谢。
没有结果应该是结果
参考CI Doc
class Queries extends CI_Model {
//Created a function with the name getRoles
public function getRoles() {
//Fetch the reocrds from the table
$roles = $this->db->get('tbl_roles');
if ($roles->num_rows() > 0) {
return $roles->result();
}
}
}
我是 CodeIgniter 的新手,在连接数据库后遇到以下错误。如果有人能帮助我,那真是太好了。我在 Whosebug 中查看了之前的答案,但 none 帮助了我。
控制器代码如下
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends MY_Controller {
public function index() {
$this->load->view('home');
}
public function adminRegister() {
//loading teh queries model
$this->load->model('queries');
//Calling the getRoles function inside the roles
$roles = $this->queries->getRoles();
print_r($roles);
exit();
$this->load->view('register');
}
public function login() {
echo 'login';
}
}
型号代码
<?php
//Details of queries whicha re used to interact with teh database
class Queries extends CI_Model {
//Created a function with the name getRoles
public function getRoles() {
//Fetch the reocrds from the table
$roles = $this->db->get('tbl_roles');
if ($roles->num_rows() > 0) {
return $roles->results();
}
}
}
?>
目前没有使用来自控制器的数据。任何帮助将不胜感激。提前致谢。
没有结果应该是结果
参考CI Doc
class Queries extends CI_Model {
//Created a function with the name getRoles
public function getRoles() {
//Fetch the reocrds from the table
$roles = $this->db->get('tbl_roles');
if ($roles->num_rows() > 0) {
return $roles->result();
}
}
}