我在删除表 mySQL 时遇到问题,但我不明白为什么。 如果你能帮助我的话。
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
include ('config.php');
// Recup the $_POST
$idTournament ='2';
// querys all the participation before to delete the tournament
$request1 = $handler->prepare('DELETE FROM Participate WHERE tournament_id = :idTournament')
//bind the parameters
$request1->bindParam(':idTournament', $idTournament, PDO::PARAM_INT);
//execute the prepared statement
$request1->execute();
?>
但是,当我将控制台置于“从...删除”行时,它就可以工作。所以...
谢谢
米奇74
最佳答案
您忘记在 prepare 语句后添加分号。
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
include ('config.php');
// Recup the $_POST
$idTournament ='2';
// querys all the participation before to delete the tournament
$request1 = $handler->prepare('DELETE FROM Participate WHERE tournament_id = :idTournament');
//bind the parameters
$request1->bindParam(':idTournament', $idTournament, PDO::PARAM_INT);
//execute the prepared statement
$request1->execute();
?>
关于php删除请求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29207519/