如何从数据库

时间:2016-01-22 05:26:31

标签: html

实际上我创建了一个表单并且输入已成功存储到数据库中..然后我以表格格式在浏览器中检索了那些输入..现在我在浏览器表中添加了另一列(删除),其中我有数据列是删除链接,移动到delete.php页面...现在我需要在display.php页面中编码删除指定的行?我试过但我不确定如何制作那个特定的行。         这是我的浏览器display.php页面                                    

    ?>
      <table border="2">
    <th>
    <tr>
          <th>SNO</th>
          <th>First Name</th>
          <th>Last Name</th>
          <th>email</th>
          <th>gender</th>
          <th>language</th>
          <th>country</th>
          <th>interest</th>
          <th>edit</th>
          <th>delete</th>
    </tr>
    </th>
    <tbody>
    <?php
        if(mysqli_num_rows($result) > 0) 
        {
         while($row = mysqli_fetch_assoc($result)) 
        {
          echo '<tr>';
          echo '<td>' .$row['SNO'] .'</td>';
            echo '<td>' . $row['firstname'] . '</td>';
          echo '<td>' . $row['lastname'] . '</td>';
           echo '<td>' . $row['email'] . '</td>';
            echo '<td>' . $row['gender'] . '</td>';
            echo '<td>' . $row['language'] .'</td>';
             echo '<td>' . $row['country'] . '</td>';
             echo '<td>' . $row['interest'] .'</td>';
             echo '<td>' .'<a href="http://192.168.1.37/TRAINING/krishnaswamy/html/edit.php">edit</a>'  .'</td>';
             echo '<td>' .'<a href="http://192.168.1.37/TRAINING/krishnaswamy/html/delete.php">delete</a>'.'</td>';
             echo '</tr>';

    }
    } 
    ?>
    </tbody>
    </table>
    </body>
    </html>
This is my code were is show the table . i made the links to move to edit.php and delete.php page respectively...so wat i need to do as acode in that respective pages

1 个答案:

答案 0 :(得分:0)

您可以在delete.php网址中添加POST变量,以便:

echo '<td>' .'<a href="http://192.168.1.37/TRAINING/krishnaswamy/html/delete.php?idX="'.$row['uniqueID'].'">delete</a>'.'</td>';

然后在delete.php页面上,您可以使用以下命令检索它:

$_POST["idX"];