我已经被警告消息困扰了一段时间,还无法解决。

<a href="works.php? TotalCompletedTasks =3">Tasks under 2</a>
    <?php

    $stmt = $con->prepare("v.MemberID, v.VisitingNumber, count(CompletedTaskID) as TotalCompletedTasks
from Visits v join CompletedTasks c
on v.VisitingNumber = c.VisitingNumber
where TotalCompletedTasks<:TotalCompletedTasks");
$stmt->bindParam(': TotalCompletedTasks', $_GET['TotalCompletedTasks'], PDO::PARAM_INT);
    $stmt->execute();

最佳答案

$stmt->bindParam(': TotalCompletedTasks', $_GET['TotalCompletedTasks'], PDO::PARAM_INT);


应该:

$stmt->bindParam(':TotalCompletedTasks', $_GET['TotalCompletedTasks'], PDO::PARAM_INT);


也就是说,您的参数名称中有多余的空格。

关于mysql - “警告:PDOStatement::execute():SQLSTATE [HY093]”的问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57176316/

10-11 12:01