Can't get data using $_POST to delete and update from database

118
March 11, 2019, at 5:00 PM

After inserting the records, what I've done in my program is let the user see the records and at the same time update and delete the records.

So this is the form:

<FORM ID="View" NAME="View" METHOD="POST" ACTION="">
<TABLE BORDER=1 WIDTH="100%">
    <TR>
        <TD COLSPAN=8 ALIGN="CENTER"><p1>REVIEW SCHEDULE</p1></TD>
    </TR>
    <?php
    $conn = mysqli_connect("localhost", "root", "", "scheduling");
    $sql="SELECT * FROM sched";
    $result=mysqli_query($conn,$sql);
    while($row = mysqli_fetch_array($result)){
    echo "<TR>";
            echo '<TD><input name="upSection" value="' . $row['Section'] . '"/></TD>';
            echo '<TD><input name="upSubject" value="' . $row['Subject'] . '"/></TD>';
            echo '<TD><input name="upUnits" value="' . $row['Units'] . '"/></TD>';
            echo '<TD><label name="upTime" id="upTime">' . $row['Time'] . '</label></TD>';
            echo '<TD><input name="upRoom" value="' . $row['Room'] . '"/></TD>';
            echo '<TD><input name="upInstructor" value="' . $row['Instructor'] . '"/></TD>';
            echo '<TD><a href="update.php?id=' . $row['Time'] . '">Update</a></TD>';
            echo '<TD><a href="delete.php?id=' . $row['Time'] . '">Delete</a></TD>';
    echo "</TR>";
    }
    ?>
<TABLE/>
<FORM/>

While this is the update.php, it didn't update, but no error exists

<?php
$section = $_POST['upSection'];
$coursecode = $_POST['upSubject'];
$units = $_POST['upUnits'];
$time = $_POST['upTime'];
$room = $_POST['upRoom'];
$ins = $_POST['upInstructor'];
$conn = mysqli_connect("localhost", "root", "", "scheduling");
$query="SELECT * FROM monday_sched WHERE (Time='$time' AND Room='$room') OR (Time='$time' AND Instructor='$ins') OR (Time='$time' AND Section='$section')";
if($result=mysqli_query($conn,$query)){
    $sql3 = "UPDATE `monday_sched` SET `Section`='$section',`Subject`='$coursecode',`Units`='$units',`Room`='$room',`Instructor`='$ins' WHERE `Time`='$time'
";
        if($conn-> query($sql3)===TRUE) {
            header('location:Input.php');
        }
        else {
            echo "Error: " . $sql3. "<br>" . $conn-> error;
        }
}
?>

same as delete.php, no error but the records didnt deleted.

<?php
//create connection_aborted
$conn = mysqli_connect("localhost", "root", "", "scheduling");
$timeP = $_POST['upTime'];
$time = mysqli_real_escape_string($conn, $timeP);
//check connection
if($conn-> connect_error) {
    die ("connection failed; ". $conn-> connect_error);
}
$sql = "DELETE FROM `sched` WHERE Time='$time'";
mysqli_query($conn, $sql);
header('location:Input.php');
$conn->close();
?>

I'm guessing that maybe the error are from the $row part or maybe from getting data using $_POST, but still don't know how to fix. Please help. It doesnt have error but didnt update and delete. Thanks

READ ALSO
how to get images from Telegram api get history method?

how to get images from Telegram api get history method?

I want get images from telegram through getHistory method, i able to found dc_id, volume_id, local_id or secret_id, let me know if anyone knows how to get images from this parametersI got below data from telegram API with getHistory method

163
how to fetch string messages from raw buffer objects Kafka java

how to fetch string messages from raw buffer objects Kafka java

There is a nodejs Kafka producer which send the file content to KafkaWhen Kafka consumer consumed the messages from Kafka it looks like -

138
Check if &lt;div data&gt; exists, if exist delete it

Check if <div data> exists, if exist delete it

Hi guys so I'm trying to run from backend in PHP where if the front-end has a div data for example

19