function first_page() { $coverpage = new Coverpage(); $coverpage->where("status = 'approve' and active = 1")->get(); if ($coverpage->id != "") { redirect("coverpages/index/" . $coverpage->id); } else { redirect("home/index"); } }
function approve2($id) { if ($_POST) { $coverpage = new Coverpage($id); $coverpage->from_array($_POST); $coverpage->save(); $coverpage->clear(); $coverpage->where('id <>', $id)->get(); $coverpage->update_all('active', 0); } }