新增資料
簡述
要看前端是用 POST
還是 GET
來帶資料的:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <?php
$username = $_POST['username'];
$sql = 'INSERT INTO users(username) VALUES("' . $username . '")';
$sql2 = sprintf('INSERT INTO users (username) VALUES ("%s")', $username);
$result = $conn->query($sql2);
if (!$result) { die($conn->error); }
header('Location: index.php'); ?>
|