使用PHP刪除所有資料(刪除SQL中的所有資料/值)
P粉803444331
P粉803444331 2023-09-02 13:35:06
0
1
328
<p>有人可以幫助我嗎,我是 PHP 程式設計新手,我想知道如何製作一個刪除按鈕,該按鈕將刪除資料庫表中的所有資料/值這是該表 這是我的按鈕代碼 This is my delete code Wanted to get help from others 這是我的按鈕代碼</p> <pre class="brush:php;toolbar:false;"><form action="delete.php" method="post"> <input type="submit" name="delete" class="btn btn-danger" value="Clear All Data's" style="float: right;"Clear All Data's" style="float: right;">"> </form> And this is my delete.php code <?php $server = "localhost"; $username = "root"; $password = ""; $dbname = "qrcodedb"; $conn = new mysqli($server,$username,$password,$dbname); if(isset($_POST['delete'])) { $name = $_POST['delete']; $query = "DELETE FROM table_attendance(NAME,TIMEIN) WHERE name='$name' "; $query_run = mysqli_query($conn, $query); if($query_run) { echo '<script> alert("Data Deleted"); </script>'; header("location:index.php"); } else { echo '<script> alert("Data Not Deleted"); </script>'; header("location:index.php"); } } ?></pre></p>
P粉803444331
P粉803444331

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!