mysql - php echoing the ACTUAL statement of a query after its executed -
this frustrates me lot since moved pdo
i have this:
$sql = "select * $table id=:id"; $this->stmt = $this->dbh->prepare($query); $this->stmt->bindvalue($param, $value, $type); bindvalue(:id => $this->user_id); $this->stmt->execute();
now select runs, doesnt break dont expected results, if echo $this->stmt this:
pdostatement object ( [querystring] => update `users` set user_active= :user_active, user_activation_hash= :user_activation_hash user_id = :user_id , user_activation_hash = :verification_code )
now looks problem values passed, instead of passing number might have messed quotes , passed $id string , didnt evaluate variable cannot figure way out see actual statement values were. there must easier way, simple standard mysql assign query variable , echo out or use or die mysql_error?
fwiw tried debugdumpparams , returns this:
update `users` set user_active= :user_active, user_activation_hash= :user_activation_hash user_id = :user_id , user_activation_hash = :verification_code params: 4 key: name: [12] :user_active paramno=-1 name=[12] ":user_active" is_param=1 param_type=2 key: name: [21] :user_activation_hash paramno=-1 name=[21] ":user_activation_hash" is_param=1 param_type=2 key: name: [8] :user_id paramno=-1 name=[8] ":user_id" is_param=1 param_type=2 key: name: [18] :verification_code paramno=-1 name=[18] ":verification_code" is_param=1 param_type=2
in guessing there no debug dump values or similar, values want debug
use $stmt->debugdumpparams();
Comments
Post a Comment