Php删除请求错误
我的表mySQL中有一个要删除的问题,我不明白为什么。 如果你能帮助我Php删除请求错误,php,mysql,Php,Mysql,我的表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
<?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();
?>
但是,当我把控制台放在DELETE from…(从…删除)行时,它就工作了。所以
多谢各位
Mickey74您忘了在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();
?>
您是否收到任何错误?执行后$request1的状态是什么?请尝试使用$request1=$handler->prepare'DELETE FROM particiate WHERE tournament_id='。$idTournament;