ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/tab-headings.php |
<?php session_start(); include"../config/config.php"; $date = date('Y-m-d h:i:s', time()); if(isset($_POST['type']) && $_POST['type']=='headings_add'){ try{ $statement = $pdo->prepare("INSERT INTO `tbl_tab_headings` (`name`,`category`,`status`) VALUES (?,?,?)"); $result =$statement->execute(array($_POST['name'],$_POST['category'],$_POST['status'])); if($result){ $return_arr['message'] = 'Tab - Heading Added Successfully!'; $return_arr['status']=200; }else{ $return_arr['message']="Something went wrong try again..."; $return_arr['status']=400; } }catch(Exception $e){ $return_arr['message']='0987'.$e; $return_arr['status']=500; } echo json_encode($return_arr); } if(isset($_POST['type']) && $_POST['type']=='headings_edit'){ try{ $statement = $pdo->prepare("UPDATE `tbl_tab_headings` SET `name`=?, `category`=?, `status`=? WHERE id=?"); $result =$statement->execute(array($_POST['name'],$_POST['category'],$_POST['status'],$_POST['ids'])); if($result){ $return_arr['message'] = 'Tab - Heading Updated Successfully!'; $return_arr['status']=200; }else{ $return_arr['message']="Something went wrong try again..."; $return_arr['status']=400; } }catch(Exception $e){ $return_arr['message']='0987'.$e; $return_arr['status']=500; } echo json_encode($return_arr); } ?>