php - PDO: UPDATE not working -
i wrote code update mysql table via php/pdo. not working , can't figure out mistake is.
execute() returns true, changes never show in table.
my code looks pretty this:
$columnobject = array( "emailaddress"=>"aaa@aaa.com", "passwordhash"=>"56bj5g63j4g57g567g5k75jh7gk4g74j5hg67", "name"=>"qweqweqwe", "lastactivity"=>4128649814 ); $knowncolumnname = "emailaddress"; $knowncolumndata = "aaa@aaa.com"; foreach ($columnobject $columnname => $columndata) { $pdoupdatestring .= $columnname . "=:" . $columnname . ","; $pdoexecuteobject[$columnname] = $columndata; } $pdoupdatestring = rtrim($pdoupdatestring, ","); $pdoexecuteobject['knowncolumn'] = $knowncolumndata; $q = $this->hcon->prepare('update ' . $this->name . ' set ' . $pdoupdatestring . ' ' . $knowncolumnname . '=:knowncolumn'); $q->execute($pdoexecuteobject);
Comments
Post a Comment