当Session StaffID与report
表中的StaffID匹配时,我正尝试从reports
检索所有报告。
Report_Name, ReportDate and ReportID are part of the report table
我认为这应该是
从ReportID
获取Report_Name
,ReportDate
和report
ReportID
Read_Report
与ReportID
匹配report
StaffID
}
在StaffID
Read_Report
= function get_read_report()
{
$this->db->select('report.Report_Name, report.ReportDate, report.ReportID')
->from('Read_Report')
->join('Read_Report', 'report.ReportID = Read_Report.ReportID')
->where('StaffID', $this->session->userdata("StaffID"));
return $result = $this->db->get();
}
时
,这是我的查询
Not unique table/alias: 'Read_Report'
SELECT `report`.`Report_Name`, `report`.`ReportDate`, `report`.`ReportID` FROM `Read_Report` JOIN `Read_Report` ON
我收到此错误
错误号码:1066
report
ReportID
。Read_Report
=ReportID
。StaffID
WHEREFilename: models/report/Report_model.php Line Number: 91
='3'function my_read_reports() { $data = array(); if ($query = $this->report_model->get_read_report()) { $data['reports'] = $query; } $this->template['middle'] = $this->load->view($this->middle = 'pages/read_reports_view', $data, true); $this->layout(); }
控制器代码
java.lang.IllegalArgumentException: DrawerLayout must be measured with MeasureSpec.EXACTLY.
答案 0 :(得分:3)
您需要将表与report
表联系起来,而不是同一个表
更改
->join('Read_Report', 'report.ReportID = Read_Report.ReportID')
要
->join('report', 'report.ReportID = Read_Report.ReportID')
您需要将查询更改为
$this->db->select('report.Report_Name, report.ReportDate, report.ReportID')
->from('report')
->join('Read_Report', 'report.ReportID = Read_Report.ReportID')
->where('Read_Report.StaffID', $this->session->userdata("StaffID"));
$result = $this->db->get();
return $result->result();// fetch data then return
答案 1 :(得分:2)
您的查询应该是
$this->db->select('report.Report_Name, report.ReportDate, report.ReportID')
->from('Read_Report')
->join('report', 'report.ReportID = Read_Report.ReportID')
->where('StaffID', $this->session->userdata("StaffID"));
return $result = $this->db->get();