当我删除或更新记录并且它已在数据库中被删除但仍显示当我点击记录显示页面的位置(通过锚点)但当我刷新此页面(通过f5)时删除的记录未显示。 问题是我不希望通过锚点在页面上显示已删除的记录,而不需要f5按下刷新。
点击此链接显示页面:
<li><a href="<?=site_url('admin_panel/portfolio_category')?>"><span class="side_icon ion-ios7-calendar-outline"></span> Portfolio Categories</a></li>
使用以下功能:
function portfolio_category($task="show",$extra=''){
if($task=="show"){
$parent_catgs = $this->theartvalley_model->show_record("*","portfolio_category","desc");
if( $parent_catgs != false ){
if(!empty($extra)) $data["status"] = $extra;
$data["parent_categories"] = $parent_catgs;
$this->admin_view("portfolio_category",$data);
} else $this->admin_view("portfolio_category");
}
else if($task=="delete"){
$this->theartvalley_model->delete_record($id,"portfolio_category");
redirect(site_url('admin_panel/portfolio_category/show'), 'refresh');
}
}
function show_record($select,$table,$order='asc'){
$this->db->select($select);
$this->db->order_by("id", $order);
$record = $this->db->get($table);
if($record->num_rows() > 0){
$data = $record->result();
return $data;
}
else return false;
}
function delete_record($id,$table){
$this->db->where('id', $id);
$this->db->delete($table);
}