Hi guys, based on image 1, I plan to update staffno in multiple rows based on appno. I aim to update staffno=3 with all appno=4. However, only 1 staffno updated. Here is the code:
<?php
if (isset($_POST['update_btn'])){
$staffno = $_POST['staffno']; // ID of the record to be updated
$update = "UPDATE applicantabove18p2
SET staffno = '$staffno'
WHERE appid = '$appid'";
$update1 = "UPDATE applicantabove18p1
SET staffno = '$staffno'
WHERE appid = '$appid'";
$update2 = "UPDATE applicantabove18p1a
SET staffno = '$staffno'
WHERE appid = '$appid'";
$update3 = "UPDATE applicantabove18att
SET staffno = '$staffno'
WHERE appid = '$appid'";
if (mysqli_query($con, $update) && mysqli_query($con, $update1) && mysqli_query($con, $update2) && mysqli_query($con, $update3)) {
if ($data){
?>
<script type="text/javascript">
alert("Data updated successfully");
window.open("coordinatorview3.php","_self")
</script>
<?php
}
else{
?>
<script type="text/javascript">
alert("Please try again");
</script>
<?php
}
}
}
?>
The code related is $update3. Please advise. Tq in advance