小编d7r*_*d7r的帖子

PDO 异常“SQLSTATE[HY093]:无效的参数号:绑定变量的数量与标记的数量不匹配”

我不熟悉 PDO 扩展,也找不到我的代码有什么问题。代码片段:

                try {
                $this->PDO->exec('SET AUTOCOMMIT = 0');
                $this->PDO->exec('START TRANSACTION');

                $this->PDO->prepare("UPDATE office_users
                                     SET balance = balance - ?
                                     WHERE id = ?")
                          ->execute(array($sbs_price, $this->user->id)
                );
                $user_balance -= $sbs_price;

                $this->PDO->prepare("UPDATE office_company
                                     SET pay_days = pay_days + ?
                                     WHERE inn = ?
                                     AND user_id = ?")
                          ->execute(array(
                                $sbs_period_days,
                                $company_inn,
                                $this->user->id)
                );

                $fin_string = $company_name.' ??? '.$company_inn.' ????????? '.$sbs_period_month. ' ???.';

                $this->PDO->prepare("INSERT INTO office_fin_transactions
                                     (user_id, date_register, dsc, amount, status)
                                     VALUES (?, ?, ?, ?, ?)")
                          ->execute(array(
                                  $this->user->id.
                                  date("Y-m-d H:i:s"),
                                  $fin_string,
                                  $sbs_price,
                                  0) …
Run Code Online (Sandbox Code Playgroud)

php mysql pdo

1
推荐指数
1
解决办法
8951
查看次数

标签 统计

mysql ×1

pdo ×1

php ×1