Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.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_Symfony_Pdo - Fatal编程技术网

Php PDO插入错误的值

Php PDO插入错误的值,php,mysql,symfony,pdo,Php,Mysql,Symfony,Pdo,我使用symfony2和PDO将值插入数据库 private static function insertAction($action, $conn){ $sql = "INSERT INTO BANKACTIONS (clientName, actionDate, currency, value, actionType) VALUES (clientName, actionDate, currency, value, actionType)";

我使用symfony2和PDO将值插入数据库

private static function insertAction($action, $conn){
            $sql = "INSERT INTO BANKACTIONS (clientName, actionDate, currency, value, actionType) VALUES (clientName, actionDate, currency, value, actionType)";
            $q = $conn->prepare($sql);
            $q->execute(array(':clientName'=>$action->getClientName(),
                ':actionDate'=>$action->getDate(),
                ':currency'=>$action->getCurrency(),
                ':value'=>$action->getValue(),
                ':actionType'=>$action->getActionType()));
        }
    }
这是阵列的变量转储

actionarray(5) { [":clientName"]=> string(6) "client" [":currentDate"]=> string(10) "1358200800" [":currency"]=> string(3) "ILS" [":value"]=> string(3) "ILS" [":actionType"]=> string(7) "deposit" }
这是正确的

但是当我在myphpadmin中检查表时

我明白了

id客户端名称actionDate货币值actionType

1 0 0 0
200
300
400
500
600
700


你能这样试试吗

private static function insertAction($action, $conn){
        $sql = "INSERT INTO BANKACTIONS 
                (clientName, actionDate, currency, value, actionType) 
                VALUES (:clientName, :actionDate, :currency, :value, :actionType)";
        $q = $conn->prepare($sql);
        $q->execute(array(
            'clientName'  => $action->getClientName(),
            'currentDate' => $action->getDate(),
            'currency'    => $action->getCurrency(),
            'value'       => $action->getValue(),
            'actionType'  => $action->getActionType()));
    }
}
2分“:”在SQL请求中,数组中没有任何内容!:)