我正在使用 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()));
}
}
这是数组的 var_dump
actionarray(5) { [":clientName"]=> string(6) "client" [":currentDate"]=> string(10) "1358200800" [":currency"]=> string(3) "ILS" [":value"]=> string(3) "ILS" [":actionType"]=> string(7) "deposit" }
哪个是对的...
但是当我在 myphpadmin 中检查表格时
我明白了
id clientName actionDate 货币值 actionType
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
7 0 0 0