2
我想從sql中刪除按鈕。我開始了一個名爲$ del的函數,但我不知道如何以當前回聲聲明旁邊的刪除按鈕的形式完成它。php sql刪除按鈕
$con = mysql_connect("localhost", "user", "pass");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sql = "INSERT INTO camps (city, map, park, day, details)
VALUES ('$_POST[city]','$_POST[map]','$_POST[park]','$_POST[day]','$_POST[details]')";
if (!mysql_query($sql, $con)) {
die('Error: ' . mysql_error());
}
$number = 0;
$del = mysql_query("DELETE FROM camps WHERE user_id= '$number'");
$result = mysql_query("SELECT * FROM camps");
while ($row = mysql_fetch_array($result)) {
echo "<a href=\"'" . $row['map'] . "\">" . $row['city'] . "</a>";
echo "<br />";
}