-1
PHP初學者在線:)。 我有兩個文件(viewKands.php-listing記錄和izbrisi.php-用於刪除數據庫中的記錄,我嘗試從db(upisi)中刪除記錄,但沒有運氣 這裏是代碼...我的錯誤在哪裏?PHP獲取id刪除記錄
viewKands.php:
$kon = mysqli_connect("localhost", "root", "", "upisi");
$kon->set_charset("utf8");
if (mysqli_connect_error()) {
echo "Greska pri konekcija so baza: " . mysql_error();
}
$sqlView = "SELECT idPrijava,brPrijava,jazik,struka,profil,imeKand,tatIme,"
. "prezKand from tblprijava ";
$result = mysqli_query($kon, $sqlView);
$rBr = 1;
while ($rowV = $result->fetch_assoc()) {
$id = $rowV["idPrijava"];
echo "<tr><td>" . $rBr . "</td><td>" . $rowV["brPrijava"] . "</td><td>" . $rowV["jazik"] . "</td><td>" . $rowV["struka"] .
"</td><td>" . $rowV["profil"] . "</td><td>" . $rowV["imeKand"] . " " . $rowV["tatIme"] . " " . $rowV["prezKand"] .
"</td><td><a href='uredi.php'>Уреди</a></td>" . " <td><a href='izbrisi.php?id=$id'>X</a></td>" . "</td></tr>";
$rBr++;
}
而且izbrisi.php(刪除記錄)
$delkon = mysqli_connect("localhost", "root","","upisi");
$delkon->set_charset("utf8");
if (isset($_GET["idPrijava"]) != "") {
$delete = $_GET["idPrijava"];
$dqry = "DELETE FROM tblprijava WHERE idPrijava='$delete'";
$delete = mysqli_query($delkon, $dqry);
if ($delkon->query($dqry) === TRUE) {
header("Location:viewKands.php");
} else {
echo mysqli_error($delete);
}
} else {
echo "ID error";
}
$delkon->close();
您是否收到任何錯誤消息? – jeff
你的意思是沒有運氣?你收到錯誤消息嗎?你檢查了錯誤日誌嗎? – tllewellyn
歡迎和請訪問本指南,以改善您的問題的質量和獲得正確答案的機會 - http://stackoverflow.com/help/how-to-ask。如果有任何錯誤消息,請提供。 – Ekin