エラーメッセージ / エラー原因 / 実際に遭遇したエラー原因具体例

PHP用語集

カテゴリー: Fatal error  閲覧数:660 配信日:2019-08-01 09:01


エラーメッセージ


( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

エラー原因


数の不一致

実際に遭遇したエラー原因具体例


修正前
update_datetime前の:が抜けている
public function updateStripe($stripeUserId, $stripeRefreshToken,$id)
{
$now = new DateTime();
$sql = "UPDATE user SET stripe_user_id=:stripe_user_id, stripe_refresh_token=:stripe_refresh_token,update_datetime =update_datetime WHERE id=:id";
$stmt = $this->execute($sql, array(
':stripe_user_id' => $stripeUserId,
':stripe_refresh_token' => $stripeRefreshToken,
':update_datetime' => $now->format('Y-m-d H:i:s'),
':id' => $id,
));
}


修正後
public function updateStripe($stripeUserId, $stripeRefreshToken,$id)
{
$now = new DateTime();
$sql = "UPDATE user SET stripe_user_id=:stripe_user_id, stripe_refresh_token=:stripe_refresh_token,update_datetime =:update_datetime WHERE id=:id";
$stmt = $this->execute($sql, array(
':stripe_user_id' => $stripeUserId,
':stripe_refresh_token' => $stripeRefreshToken,
':update_datetime' => $now->format('Y-m-d H:i:s'),
':id' => $id,
));
}


指定期間人気ページランキング / 2020-5-28 → 2026-5-4
順位 ページタイトル抜粋 アクセス数
1 PHP用語 7057
2 ブラウザを閉じたらセッションデータはどうなるの? | セッション 2559
3 Parse error: syntax error, unexpected 'public' (T_PUBLIC) | Parse error(エラーメッセージ) 2518
4 ブラウザを閉じたらセッションデータはどうなるの? | セッション 1712
5 【テスト投稿】テスト | 1133
6 セッション管理が必要な理由は、HTTPプロトコルには状態を保持する機能がないため | セッション 1091
7 PHPで定数を定義する方法は2種類ある / 配列定数の定義 1069
8 Fatal error: Access level to ▲::$△ must be protected (as in class ●) or weaker | Fatal error(エラーメッセージ) 911
9 Fatal error: Uncaught Error: Call to a member function modify() on string | Fatal error(エラーメッセージ) 883
10 コード例 … 「例外処理」はネストすることができる 870
11 curl で Cookie を使用する 865
11 Fatal error: require_once(): Failed opening required 'PEAR.php' | Fatal error(エラーメッセージ) 865
12 Fatal error: Uncaught RuntimeException: SplFileObject::__construct(): failed to open stream: Permission denied in | Fatal error(エラーメッセージ) 753
13 定数 740
14 インターフェイス | クラスとオブジェクト 702
15 Fatal error: Uncaught HeadlessChromium\Exception\OperationTimedOut: Operation timed out (3sec) in | Fatal error(エラーメッセージ) 698
16 メンバー | クラスとオブジェクト 649
17 Warning: include() [function.include]: Failed opening '**.php' for inclusion (in | Warning(エラーメッセージ) 644
18 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column | Fatal error(エラーメッセージ) 612
18 Warning: strlen() expects parameter 1 to be string, array given in ○○.php on line △△ | Warning(エラーメッセージ) 612
2026/5/5 6:00 更新