[eluser]Was[/eluser]
Hello Friends,
i m using CI 2.1.0. i have done admin section for one of my website. when i m deleting content from admin its get deleted and after delete i m redirecting it with redirect('admin/myfunction', 'refresh');.its redirecting properly but showing the deleted data also for this every time i need to refresh manually and then it will not showing the deleted data. i m not getting what's wrong here,any one guide me how to solve this ?
thanx
Was
[eluser]the_unforgiven[/eluser]
remove the "refresh" for the redirect that should work!
[eluser]Was[/eluser]
Hello thanx for the reply,
i have tried with removing the 'refresh'. its deleted the data but cant redirect anywhere and i have tried with keeping '' in place of refresh it will redirect the page but still showing the deleted data and i need to refresh the page manually again to see the result.is there any other way to solve this?
thanx
Was
[eluser]soijiro[/eluser]
I'm not sure what's your problem.
But for the best suggestion, you can show us what's in your controller.
[eluser]Was[/eluser]
Hello, thanx for the reply
here is the my code which i m using
function deleteproduct($id)
{
if($this->session->userdata('admin_id')!='')
{
if($id)
{
$this->common->db_delete('product','id',$id);
redirect('admin/products', 'refresh');
}
else
{
redirect('admin/products', 'refresh');
}
}
else
{
redirect('admin', 'refresh');
}
}
So its deleting the product and redirecting on listing page but still the deleted item is appearing on my listing page and i need to refresh the page manually then the deleted item is disappear from listing page. so this is the problem.
thanx
Was
[eluser]soijiro[/eluser]
did you working with cache?
products method code please.
[eluser]Was[/eluser]
Hello,
here is the my products listing code and i m not using any cache method.
function products($page=0)
{
$config['base_url'] = base_url().'index.php/admin/products/';
$config['total_rows'] =$this->common->numberofrecord("*","products","");
$config['per_page'] =30;
$config['uri_segment']=3;
$this->pagination->initialize($config);
$data_common=$this->common->fetchdata("*","products","","order by id desc",$page,$config['per_page']);
$data['data_common']=$data_common;
if($this->session->userdata('admin_id')!='')
{
$this->load->view('admin/header');
$this->load->view('admin/products',$data);
$this->load->view('admin/footer');
}
else
{
redirect('admin','');
}
}
and this is the common query which i have written in models for fetching the data
function fetchdata($fieldname,$tblname,$where,$orderby,$page,$max)
{
$query=$this->db->query("select ".$fieldname." from ".$tblname." ".$where." ".$orderby." limit $page,$max");
$data=$query->result_array();
return $data;
}
thanx
Was