0

I have this PDO statement:

parent::$db->custom('UPDATE users_credits SET availabe = availabe - :reward_credits, used = used + :reward_credits WHERE user_id = :user_id', array(
    'reward_credits' => $reward_credits,
    'user_id' => $user_id
));

For some reasons it simply does not work. I tried the very same query on the DB manually and it works. What's wrong with PDO and how do I achieve the very same result I would achieve normally?

Thanks for any suggestion

4

1 回答 1

0

首先。PDO 没有任何问题,而且从来没有。应该归咎于 您自己
的一些自定义代码。

解决任何 PDO 相关问题的简单清单

  1. 确保您可以看到所有 PHP 错误。
  2. 配置 PDO 以在 SQL 错误中引发异常,方法是在连接后调用它

    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
  3. 调试你的代码。
于 2013-10-10T10:24:40.507 回答