更新检索的数据

时间:2014-08-21 00:28:54

标签: php mysql

您好我在制作页面批准和拒绝数据库中的名称的过程中,我目前已经拥有它所以它发现拉动待处理的请求我正在寻找现在我想知道如何更新行一旦我点击批准或否认。

需要更新的值是NameState列("已批准")或(" REJECTED")

一次可以有1到100个名字。

谢谢Ryan

 $DB_HOST = "IP";
        $DB_USER = "user";
        $DB_PASS = "Pass";
        $DB_DTBS = "DB";
        mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die(mysql_error()); // Connect to database server(localhost) with username and password.
        mysql_select_db($DB_DTBS) or die(mysql_error()); // Select registration database.

        $search = mysql_query('SELECT * FROM TABLE WHERE `NameState` = \'(\"PENDING")\'') or die(mysql_error()); 

        $match  = mysql_num_rows($search);


        if($match > 0){
            echo "<table border='1'>
                    <tr>
                    <th>ID</th>
                    <th>Current Name</th>
                    <th>Requested Name</th>
                    <th>Approve or Deny</th>
                    </tr>";

            while($row = mysql_fetch_array($search)) {
                echo "<tr>";
                echo "<td>" . $row['object_id'] . "</td>";
                echo "<td>" . $row['Name'] . "</td>";
                echo "<td>" . $row['WishName'] . "</td>";
                echo '<td> <form method="post" action=<?php echo Approve:<input type="radio" value="Approve" name="name"> Deny:<input type="radio" value="Deny" name="name"><br /> </td>';
                echo "</tr>";
            }

            echo "</table>";

            echo '<input type="Submit" value="Submit" name="Submit"> </form>';

        } else {
            echo("No Names to Approve");
        }

    ?>

0 个答案:

没有答案