2 回答

TA貢獻(xiàn)1772條經(jīng)驗 獲得超6個贊
試試這個伙伴 :)
<?php
function apaga(){
$conexao = mysqli_connect("localhost", "root", "", "fct");
if($conexao->connect_error){
die("Falha ao conectar ao servidor: ".$conexao->connect_erro);
}
$queryselect=$conexao->query("SELECT * FROM mostra1")or die(mysqli_error($conexao));;
while($row=$queryselect->fetch_assoc()){
$id=$row['id'];
$sql= "DELETE FROM mostra1 WHERE data < (NOW() - INTERVAL 1 MINUTE)";
mysqli_query($conexao,$sql);
}
}
apaga();
?>

TA貢獻(xiàn)1811條經(jīng)驗 獲得超4個贊
您的數(shù)據(jù)庫可能正在安全模式下運(yùn)行。嘗試在刪除之前添加與此 SQL 等效的 PHP:
設(shè)置 SQL_safe_updates = 0;
然后刪除后:
設(shè)置 SQL_safe_updates = 1;
- 2 回答
- 0 關(guān)注
- 191 瀏覽
添加回答
舉報