Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php PDO无效参数编号错误消息_Php_Mysql_Pdo - Fatal编程技术网

Php PDO无效参数编号错误消息

Php PDO无效参数编号错误消息,php,mysql,pdo,Php,Mysql,Pdo,我正在运行此PDO SQL查询: $stmt = $pdo_conn->prepare("INSERT into ticket_updates (ticket_seq, notes, datetime, updatedby, customer, internal_message) values (:ticket_seq, :notes, :datetime, :updatedby, :customer, :internal_message) "); $stm

我正在运行此PDO SQL查询:

$stmt = $pdo_conn->prepare("INSERT into ticket_updates (ticket_seq, notes, datetime, updatedby, customer, internal_message) values (:ticket_seq, :notes, :datetime, :updatedby, :customer, :internal_message) ");
                $stmt->execute(array(':ticket_seq' => $ticketnumber, 
                ':notes' => addslashes($message), 
                ':datetime' => date("Y-m-d H:i:s"),  
                ':updateedby' => $last_updated_by, 
                ':customer' => 'Y', 
                ':internal_message' => 'no'));
但是得到这个错误:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in /home/integra/public_html/autocheck/support_emails.php:479 Stack trace: #0 /home/integra/public_html/autocheck/support_emails.php(479): PDOStatement->execute(Array) #1 {main} thrown in /home/integra/public_html/autocheck/support_emails.php on line 479

我不确定是什么问题,所有其他查询在prepare中运行良好,您调用此参数
updatedby
,但在bind中,您有
updatedby
修复此问题,也许它可以解决您的错误。

在prepare中,您调用此参数
updatedby
但在bind中,您有
updatedby
修复此问题,也许它可以解决您的问题错误。

可能是输入错误,因为错误消息显示:参数未定义。仔细检查您的参数。

可能是输入错误,因为错误消息显示:参数未定义。仔细检查您的参数。

在这种情况下,您可能需要使用未命名的参数。这样可以省去你两次打字的麻烦,提高可维护性

$stmt = $pdo_conn->prepare(
    "INSERT into ticket_updates (".
        "ticket_seq, notes, datetime, updatedby, customer, internal_message)". 
        "values (?, ?, ?, ?, ?, ?)");

$stmt->execute(array(
            $ticketnumber, 
            addslashes($message), 
            date("Y-m-d H:i:s"),  
            $last_updated_by, 
            'Y', 
            'no'));

在这种情况下,您可能希望使用未命名的参数。这样可以省去你两次打字的麻烦,提高可维护性

$stmt = $pdo_conn->prepare(
    "INSERT into ticket_updates (".
        "ticket_seq, notes, datetime, updatedby, customer, internal_message)". 
        "values (?, ?, ?, ?, ?, ?)");

$stmt->execute(array(
            $ticketnumber, 
            addslashes($message), 
            date("Y-m-d H:i:s"),  
            $last_updated_by, 
            'Y', 
            'no'));

谢谢-抱歉,这是漫长的一天!:)这发生在我们所有人身上谢谢-抱歉,这是漫长的一天!:)这发生在我们所有人身上