php-mysql更新和删除won';不会在home.php上生效


php mysql update and delete won't take effect on home.php

我将如何使$UpdateQuery和$DeleteQuery函数工作?我已经键入了这些代码以便运行,但home.php文件中没有任何更改??

以下是update.php中的代码:[这是我使用的名为ruiz的数据库,表为"registry"]

    <?php
    if (isset($_POST['update'])){
$UpdateQuery = "UPDATE registry SET db_id = '$_POST[db_id]', db_name = '$_POST[db_name]', db_age = '$_POST[db_age]', db_gender = '$_POST[db_gender]', db_birthdate = '$_POST[db_birthdate]', db_phone = '$_POST[db_phone]', db_address = '$_POST[db_address]' 
                WHERE db_id = '$_POST[hidden]'";
                mysqli_query(UpdateQuery);
        //redirect to home.php
        header('Location: home.php');
            }
            $query= mysqli_query( $DB,"SELECT * FROM registry" );
        echo"<h2><center>Employee Masterlist</center></h2>";
        echo "<table class = '"form'" border = '"1'" cellspacing = '"3'">";
        echo "<tr>";
        echo "<th>Employee ID</th>";
        echo "<th>Name</th>";
        echo "<th>Age</th>";
        echo "<th>Gender</th>";
        echo "<th>Birthdate </th>";
        echo "<th>Phone No. </th>";
        echo "<th>Address </th>";
        echo "</tr>";

            if(mysqli_num_rows($query) > 0){
            while($row = mysqli_fetch_assoc( $query))
            {
                    echo "<form action=update.php method=post>";
                    echo "<tr>";
                    echo "<td>" . "<input id=input-up type=text name=db_id 
                    value=" . $row['db_id'] . "> </td>";
                    echo "<td>" . "<input id=input-up type=text name=db_name 
                    value=" . $row['db_name'] . "> </td>";
                    echo "<td>" . "<input id=input-up type=text name=db_age 
                    value=" . $row['db_age'] . "> </td>";
                    echo "<td>" . "<input id=input-up type=text 
                    name=db_gender value=" . $row['db_gender']. "> </td>";
                    echo "<td>" . "<input id=input-up type=text 
                    name=db_birthdate value=" . $row['db_birthdate'] . ">   
                        </td>";
                    echo "<td>" . "<input id=input-up type=text 
                    name=db_phone value=" . $row['db_phone'] . "> </td>";
                    echo "<td>" . "<input id=input-up type=text 
                    name=db_address value=" . $row['db_address'] . ">
                    </td>";
                    echo "<input type=hidden name=hidden value=" . 
                    $row['db_id'] . "> </td>";
                    echo "<td>" . "<input class=send_btn type=submit 
                    name=update value=Update". "> </td>"; 
                    echo "</tr>";
                    echo "</form>";
            }
            }
            echo"</table>";
                ?>  
                    </div>
                    </body>
                    </html>

这些是delete.php中与上一个数据库相同的代码,ruiz中的表"registry"

            <?php
            if (isset($_POST['delete'])){
$DeleteQuery = "DELETE FROM registry WHERE db_id = '$_POST[hidden]'";
mysqli_query($DeleteQuery);
//redirect to home.php
header('Location: home.php');
            }       
            $query= mysqli_query( $DB,"SELECT * FROM registry" );

        echo"<h2><center>Employee Masterlist</center></h2>
        <table class = '"form'" border = '"1'" cellspacing = '"3'">
        <tr>
        <th>Employee ID</th>
        <th>Name</th>
        <th>Age</th>
        <th>Gender</th>
        <th>Birthdate </th>
        <th>Phone No. </th>
        <th>Address </th>
        </tr>";

            if(mysqli_num_rows($query) > 0){
            while($row = mysqli_fetch_assoc( $query))
            {
                    echo "<form action=delete.php method=post>";
                    echo "<tr>";
                    echo "<tr>";
                    echo "<td>".$row['db_id']."</td>";
                    echo "<td>".$row['db_name']."</td>";
                    echo "<td>".$row['db_age']."</td>";
                    echo "<td>".$row['db_gender']."</td>";
                    echo "<td>".$row['db_birthdate']."</td>";
                    echo "<td>".$row['db_phone']."</td>";
                    echo "<td>".$row['db_address']."</td>";
                    echo "<input type=hidden name=hidden value=" . $row['db_id'] . "> </td>";
                    echo "<td>" . "<input class=send_btn type=submit name=delete value=Delete". "> </td>";
                    echo "</tr>";
                    echo "</form>";
            }
                }
            echo"</table>";
?>  
$delete_id = $_GET['del'];
$query = "delete from users where id='$delete_id'";
if(mysql_query($query)){
echo
"<script>
window.open('home.php')
</script>";
}

试着这样做,如果它有效或你有任何问题,请回复我。