我想根據唯一的ID($ id)刪除我的數據庫中的記錄。這段代碼有什麼問題嗎?可能是你的一個簡單的PHP專業版。MySQL從表中刪除項目不起作用
function delAccount(){
mysql_query("DELETE FROM accounts WHERE id=".$id."LIMIT 1");
}
我得到一個:
Fatal error: Can't use function return value in write context in
/home/content/53/7311353/html/cca/accounts/include/processAct.php on line 15
我的班級我都供電一切:
class Accounts
{
function Accounts(){
if (isset($_POST['addacct'])){
$this->addAccount();
}elseif(isset($_POST['editacct'])){
$this->editAccount();
}elseif(isset($_POST['delacct'])){
$this->delAccount();
}else{
// redirect if loaded without a POST value set
header("Location: ../index.php?o=illegal&t=nodata");
}
}
顯示'$ id'來自 – 2011-05-13 12:17:21
顯示完整的代碼。我們不可能知道'15號線'在哪裏,也不在那裏。 – 2011-05-13 12:27:01
@Mustafa:你爲什麼要刪除錯誤信息,並且**和**將T-SQL問題重新標記爲MySQL問題? – BoltClock 2011-05-13 12:30:45