[php-src] Issue #7903: `mysqli` does not bind params the same way `PDO` does
| From: | mvorisek | Date: | Fri, 07 Jan 2022 09:46:01 +0000 |
| Subject: | [php-src] Issue #7903: `mysqli` does not bind params the same way `PDO` does | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238842@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7903
Author: mvorisek
### Description
The following query work with PDO:
```sql
select
id, name, code, is_eu, (select
group_concat(name separator :a) name from user
_U_f9aae5fda8d8 where country_id = country.id)
user_names from country where id = :b limit 0, 2
array(2) {
[":a"]=>
string(1) ","
[":b"]=>
int(3)
}
```
but the following query (with named params converted to numerical ones) does not work:
```sql
select id, name, code, is_eu, (select
group_concat(name separator ?) name from user
_U_f9aae5fda8d8 where country_id = country.id)
user_names from country where id = ? limit 0, 2
array(2) {
[1]=>
string(1) ","
[2]=>
int(3)
}
```
Resulted in this error:
```
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near '?) name from user
_U_f9aae5fda8d8 where country_id = country.id)
`us' at line 1
```
But I expected this output instead:
no error
### PHP Version
PHP 7.4, 8.0
### Operating System
Windows, linux