код моего контроллера заяц //
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Upload_file extends CI_Controller
{
public function __construct()
{
parent::__construct();
// Load Upload_model//
$this->load->model('Upload_model');
$this->load->library('session','upload');
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
$this->load->library('pagination');
}
public function delete_data($doc_id)
{
$status = $this->db->query("select status from doc_upload where doc_id = '".$doc_id."'")->row_array();
$this->db->update('doc_upload',$status);
if($this->db->set($status==1))
{
$status = 0;
$n=$this->Upload_model->delete_data($doc_id,$status);
redirect("Upload_file/upload_list");
}
else
{
$status =1 ;
redirect("Upload_file/upload_list");
}
}
// код моей модели заяц сейчас ... //
<?php
class Upload_model extends CI_Model
{
public function __construct()
{
parent::__construct();
/* Load database */
$this->load->database();
}
function delete_data($doc_id,$status)
{
/* delete from doc_upload where doc_id = doc_id */
$this->db->where('doc_id',$doc_id);
$this->db->where('status',$status);
$n=$this->db->delete("doc_upload",$doc_id);
return $n;
}