Viewing file: update_staff_action.php (1.03 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php require 'connection.php';
$id=$_POST['id']; $name=$_POST['staffname']; $email=$_POST['staffemail']; $password=$_POST['staffpassword']; $technology=$_POST['technology']; //print_r($technology);
//$sql1 = "UPDATE `admin` SET `name`='$name',`email`='$email',`password`='$password' where `id`='$id'";
$sql = "UPDATE `admin` SET `name` = '$name',`email`='$email',`password`='$password' WHERE `id` = '$id' "; $result = $con->query($sql); //$result=$con->query($sql); $count=$con->affected_rows; $query="delete from staff_technology where staff_id='$id'"; $re=$con->query($query); foreach ($technology as $value) { //echo $value; $ins = " INSERT INTO staff_technology (staff_id, technology_id) VALUES ('$id', '$value')"; $res=$con->query($ins); $co=$con->affected_rows; }
if ($count>0) {
header("Location:view_staff.php?s=success");
// echo json_encode(array("statusCode"=>200)); } else { header("Location:view_staff.php?s=success"); // echo json_encode(array("statusCode"=>201)); } ?>
|