【发布时间】:2015-11-12 17:23:37
【问题描述】:
您好,我想从我的数据库中的表中列出一些用户。
型号:
class listPatients {
private $list_patients;
function __construct() {
$this->list_patients = array($patient);
}
//put your code here
function list_patients() {
$this->db->from('Users');
$this->db->where('patient', 1);
$this->db->select('id, username, Email');
$patient[]=$this->db->get()->result();
return $patient[];
}
`
查看
<?php echo $patient[] ?>
控制:
public function list_patients() {
$data["list_patients"] = $this->listPatients->list_patients();
$this->load->view('mainview',$data);
}
我想显示患者列表(患者列的用户 = 1),我遇到了一些问题,有人可以帮忙
【问题讨论】:
-
你遇到了什么问题?
-
我收到此错误:遇到 PHP 错误 严重性:通知消息:未定义变量:患者文件名:views/mainview.php 行号:58 回溯:文件: /home/a15_web01/web/app/application/views/mainview.php 行:58 功能:_error_handler 文件:/home/a15_web01/web/app/application/controllers/Main.php 行:18 功能:解析文件:/home /a15_web01/web/app/index.php 行:292 功能:require_once
-
你试过我的答案了吗
标签: php mysql codeigniter model-view-controller