update standardstep
This commit is contained in:
@@ -9,41 +9,35 @@ include('db-connect.php');
|
||||
|
||||
$input = filter_input_array(INPUT_POST);
|
||||
|
||||
if ($input['action'] === 'edit')
|
||||
{
|
||||
$sqlSelect="SELECT * FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'";
|
||||
$records=mysqli_query($con,$sqlSelect);
|
||||
if(mysqli_num_rows($records)>0){
|
||||
if(isset($input['idprotectioncategory'])){
|
||||
$q_idprotectioncategory = "idprotectioncategory='{$input['idprotectioncategory']}'" ;
|
||||
}else{
|
||||
if ($input['action'] === 'edit') {
|
||||
$sqlSelect = "SELECT * FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'";
|
||||
$records = mysqli_query($con, $sqlSelect);
|
||||
if (mysqli_num_rows($records) > 0) {
|
||||
if (isset($input['idprotectioncategory'])) {
|
||||
$q_idprotectioncategory = "idprotectioncategory='{$input['idprotectioncategory']}'";
|
||||
} else {
|
||||
$q_idprotectioncategory = "";
|
||||
}
|
||||
|
||||
if(isset($input['iddpicategory'])){
|
||||
$q_iddpicategory = "iddpicategory='{$input['iddpicategory']}'" ;
|
||||
}else{
|
||||
if (isset($input['iddpicategory'])) {
|
||||
$q_iddpicategory = "iddpicategory='{$input['iddpicategory']}'";
|
||||
} else {
|
||||
$q_iddpicategory = "";
|
||||
}
|
||||
|
||||
$sql = "UPDATE trfstandards SET {$q_idprotectioncategory} {$q_iddpicategory} WHERE idtrfstandards='" . $input['id'] . "'";
|
||||
// mysqli_query($con,$sql);
|
||||
} else {
|
||||
$sql = "INSERT INTO trfstandards SET idtrfdetails ='" . $input['idtrfdetails'] . "', idstandards='" . $input['idstandards'] . "'" . " , idprotectioncategory='" . $input['idprotectioncategory'] . "'" . " , iddpicategory='" . $input['iddpicategory'] . "'";
|
||||
}
|
||||
else {
|
||||
$sql = "INSERT INTO trfstandards SET idtrfdetails ='" . $input['idtrfdetails'] . "', idstandards='" . $input['idstandards'] . "'" ." , idprotectioncategory='" . $input['idprotectioncategory'] . "'" ." , iddpicategory='" . $input['iddpicategory'] . "'";
|
||||
}
|
||||
|
||||
mysqli_query($con,$sql);
|
||||
|
||||
|
||||
}
|
||||
if ($input['action'] === 'delete')
|
||||
{
|
||||
mysqli_query($con,"DELETE FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'");
|
||||
}
|
||||
mysqli_query($con, $sql);
|
||||
}
|
||||
if ($input['action'] === 'delete') {
|
||||
mysqli_query($con, "DELETE FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'");
|
||||
}
|
||||
|
||||
|
||||
//mysqli_close($mysqli);
|
||||
|
||||
echo json_encode($input);
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user