php删除请求错误

标签 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->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/

相关文章:

php - mysql 并选择到 OUTFILE - 将二进制数据写入文件

php - 无法插入数据 php mysql - 整数

php - 在 PHP 中缓存来自 MySQL 的数据?

php - 处理大格式输入中的 "Kill"

mysql - 如何在 Windows 中备份多个 MySQL 数据库中的每个表?

php - cakephp中通过外键显示数据

php - PHP5 中的接口(interface)有什么好处?

mysql - 将 MySQL 存储过程添加到 Entity Framework 上下文时出现外键约束错误

php - 在 Ubuntu Trusty 上处理 php5.4

php - 在javascript中打印页面