告訴我,可能是什麼問題?我盡其所能,但不斷顯示'錯誤'。 控制器:從數據庫中刪除不起作用
<?php
class Boss extends CI_Controller {
function __construct()
{
parent:: __construct();
$this->load->model('boss_model');
$this->load->model('news_model');
$this->load->model('reviews_model');
}
public function index()
{
if($this->userlib->logged_in_boss() == FALSE)
show_404();
$data['news'] = $this->news_model->get_news();
$data['reviews'] = $this->reviews_model->get_reviews();
$this->load->view('boss/main.php', $data);
}
public function review_del($id)
{
$delete = $this->reviews_model->del_review($id);
if($delete)
{
echo "Success";
}
else
{
echo "Error";
}
}
}
reviews_model:
<?php
class Reviews_model extends CI_Model {
public function del_review($id = null)
{
$this->db->delete('reviews', array('id' => $id));
}
}
P.S. - 表'評論'不是空的,'數據庫'包含在autoload.php中
$ id在哪裏定義? – sinisake
我寫example.com/boss/review_del/1並顯示false:c – user2639766