与“警告:PDOStatement :: execute():SQLSTATE [HY093]”有关的问题

时间:2019-07-24 06:11:25

标签: mysql

我已经被警告消息困扰了一段时间,却无法弄清。

<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();

1 个答案:

答案 0 :(得分:0)

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

应为:

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

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