disable_error(); $FN->session_enable(); $FN->set_timezone(); date_default_timezone_set('Asia/Kolkata'); $cur_date = date('Y-m-d', time()); $Query = "update " . $_REQUEST["tablename"] . " SET status='" . $_REQUEST["status"] . "',status_date='" . $cur_date . "' where id='" . $_REQUEST["id"]."'"; $DB->query($Query); if($_REQUEST["status"]=='1') { /*update*/ $Quer_correction_1 = "SELECT leave_date,employee_id from " . $_REQUEST["tablename"] . " where id='" . $_REQUEST["id"]."' "; $name_correction_1=$DB->query($Quer_correction_1); $row123_correction_1 = mysql_fetch_array($name_correction_1); $tablename1= "tbl_attendance"; $Query_last_invoice = "SELECT id from tbl_attendance where emp_id='" . ucfirst(trim($row123_correction_1["employee_id"])) . "' and date ='" . ucfirst(trim($row123_correction_1["leave_date"])) . "' "; $name_last_invoice=$DB->query($Query_last_invoice); $noo=mysql_num_rows($name_last_invoice); if( $noo==0 ) { $Query_2 = "insert into $tablename1 values( NULL,'" . ucfirst(trim($row123_correction_1["employee_id"])) . "','','" . ucfirst(trim($row123_correction_1["leave_date"])) . "')"; $DB->query($Query_2); } } /*update*/ if (isset($_REQUEST["view_id"]) && !empty($_REQUEST["view_id"])) { echo $FN->page_redirect( ROOTPATH. USERPATH . 'index.php?page_id='.$_REQUEST["page_id"].'&msg=' .SUCCESS . '&view_id=' . $_REQUEST["view_id"]); }else{ echo $FN->page_redirect( ROOTPATH .USERPATH . 'index.php'.$_REQUEST["returnpage"].'&msg=' .SUCCESS); } ?>