php - PDO inserts wrong values -


i using symfony2 , pdo insert values database.

private static function insertaction($action, $conn){             $sql = "insert 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()));         }     } 

this var_dump array

actionarray(5) { [":clientname"]=> string(6) "client" [":currentdate"]=> string(10) "1358200800" [":currency"]=> string(3) "ils" [":value"]=> string(3) "ils" [":actiontype"]=> string(7) "deposit" } 

which correct...

but when check table in myphpadmin

i

id clientname actiondate currency value 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

can try :

private static function insertaction($action, $conn){         $sql = "insert 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 points ":" in sql request , nothing in array ! :)


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -