在下面的控制器中使用这个 site_model 会给我一个 500 内部错误。我什至无法将模型添加到我的索引中。我可以在另一个控制器中使用这个模型,而不是索引。
我的模型课有什么问题吗?
class Site_model extends CI_Model{
function getAll(){
$q = $this->db->get('ci_test');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function getAllCup(){
$q = $this->db->get('cup');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function getOrderCup(){
session_start();
$order = $_SESSION['order'];
$this->db->select('product_id','name','description','price');
foreach($order as $product):
$this->db->where('product_id', $product['product_id']);
endforeach;
$q = $this->db->('cup');
if($q->num_rows() > 0){
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
}
/////
class Checkout extends CI_Controller{
function index()
{
$data['main_content'] = "checkout";
$this->load->view("includes/template",$data);
}
function review()
{
$this->load->model('site_model');
/*echo json_encode($this->site_model->getOrderCupcakes());*/
echo "sfsfdsf";
}
}