note 129916 added to pdostatement.execute
| From: | kawewong@gmail.com | Date: | Sat, 14 Dec 2024 20:36:55 +0000 |
| Subject: | note 129916 added to pdostatement.execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221721@lists.php.net to get a copy of this message | ||
If you have a sql statement and bind value like this
<?php
$sql = 'SELECT * FROM
table
#WHERE column = :column
ORDER BY id DESC';
$Sth = $dbh->prepare($sql);
$Sth->bindValue(':column', 'column_value');
$Sth->execute();
?>
It will be working fine on PHP 8.3.latest or older. But it will be error: " Fatal error:
Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not
match number of tokens" since PHP 8.4.
The #WHERE is sql commented code but it used to work with no problem. To make it work again in PHP
8.4, comment out on the code line //$Sth->bindValue().
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 184.22.231.125)
----
Manual Page -- https://php.net/manual/en/pdostatement.execute.php
Edit -- https://main.php.net/note/edit/129916
Del: integrated -- https://main.php.net/note/delete/129916/integrated
Del: useless -- https://main.php.net/note/delete/129916/useless
Del: bad code -- https://main.php.net/note/delete/129916/bad+code
Del: spam -- https://main.php.net/note/delete/129916/spam
Del: non-english -- https://main.php.net/note/delete/129916/non-english
Del: in docs -- https://main.php.net/note/delete/129916/in+docs
Del: other reasons-- https://main.php.net/note/delete/129916
Reject -- https://main.php.net/note/reject/129916
Search -- https://main.php.net/manage/user-notes.php