php - PDO foreach loop over bindParam with a reference return wrong result -
i think i've read many topics on question still wrong result. have query parameters array want loop foreach() bind parameters.
foreach($aqueryparams $key => &$value){     $stmt->bindparam($key, $value); } this concerns insert query , result key inserted in table instead of value. i'm sure key , value , @ place. var_dump() on $key , $value give :firstname $key , samy &$value. :firstname inserted in table...
and tried bindvalue without using reference , it's same result.
to clearer, give link of github repository. can see declaration of parameters array in clientmanager.class.php @ line 44, , foreach() loop bind parameters in dboperation.class.php @ line 97. https://github.com/code-climber/car_rental/blob/preparedstmt/src/car_rental/model/dao/clientmanager.class.php
i'm going mad this.
ok, found wrong. sql query. had put quotes around each values parameters. did not have error message, focused on thing new me, loop on bindparam().
i find moderator bit severe clarity of question because read can on reference...it not duplicate. error elsewhere.
Comments
Post a Comment