您好我有一個數據表,它將從我的數據庫中獲取數據,並將它顯示在我的表中,但與數據表我創建兩個動作鏈接一個是編輯和另一種是刪除 和我創建了一個功能進行刪除,現在我想用它在我的刪除鏈接我使用它,但它刪除我所有的記錄,當我嘗試使用它 這裏是我的代碼試圖如何創建一個功能在html鏈接上使用
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td align='center'>$row[name]</td>";
echo "<td align='center'>$row[add1]</td>";
echo "<td align='center'>$row[city]</td>";
echo "<td align='center'>$row[tel]</td>";
echo "<td align='center'>$row[mobile1]</td>";
echo "<td align='center'>$row[contpers1]</td>";
echo "<td><a href=\"cutomer.php?mode=false?code=$row[accode]?mode=false\"><img src='images/edit.png'></a> <a href='?delete' onClick=\"return confirm('Confrim Delete?');\"><img src='images/delete.png'></a></td>";
echo "</tr>";
if (isset($_GET["delete"])) {
delete($zdb, "accmast", "accode", $row["accode"], "custmain.php");
}
}
這裏是我的功能
function delete($mydb, $table, $vouch, $chk, $file){
mysql_select_db($mydb);
$qry= mysql_query("DELETE FROM $table WHERE $vouch='$chk'") or die(mysql_error());
header("refresh: 1; $file");
}
您正在濫用/濫用'echo'功能。你知道,你只能使用它一次 – samayo 2013-04-26 16:21:26
@PHPfan - 這是我的新信息,你可以在PHP文檔中引用它嗎? – Stevie 2013-04-26 16:23:41
我認爲PHPfan是說他只有一次使用它,而不是多次。 – 2013-04-26 16:24:50