这让我很沮丧了很多,因为我搬到PDOPHP呼应查询的实际语句后的执行
我有这样的事情:
$sql = "select * FROM $table where id=:id";
$this->stmt = $this->dbh->prepare($query);
$this->stmt->bindValue($param, $value, $type);
bindValue(:id => $this->user_id);
$this->stmt->execute();
现在选择运行,那并不破坏任何东西,但我没有得到预期的结果,如果我回声$这个 - > stmt是我得到的是这样的:
PDOStatement Object ([queryString] => UPDATE `users`
SET user_active= :user_active, user_activation_hash= :user_activation_hash
WHERE user_id = :user_id AND user_activation_hash = :verification_code)
现在看起来不错,所以这个问题是最有可能与传递的值,所以不是传递一个数字我可能已经搞砸了引号,并通过$ id作为字符串,它没有评估变量,但我无法想出一个出路,看看实际的语句值是什么。必须有一个更简单的方法,这是非常简单的标准mysql只需将查询分配给一个变量并回显出来或使用或死亡mysql_error?
FWIW我想debugDumpParams它只返回此:
UPDATE `users` SET user_active= :user_active, user_activation_hash= :user_activation_hash WHERE user_id = :user_id AND 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
在猜测有没有类似的调试转储值什么的,它的价值我想调试
我想你的意思是'where id =:id'对吗? – Mike
正确,编辑 – user1547410
那么,如果不是预期的结果,你会得到什么? –