混水摸魚

[ PHP ] – #教學- PDO DELETE 基礎範例

PDO DELETE 基礎範例

[php]
<?php
$code=$_POST[‘code’];//會員編號
//欲執行的sql語法
$sth = $db->prepare("DELETE FROM where member_code=:code");
//欄位與相對應變數
$sth->bindParam(‘:code’,$code);
//執行
$stmt=$sth->execute();
//若執行有錯誤輸出錯誤訊息並將程式中斷執行
if (!$stmt) {print_r($sth->errorInfo());exit();}
?>
[/php]
回PHP教學目錄

Leave a Comment

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *