-
Notifications
You must be signed in to change notification settings - Fork 8k
mysqli does not bind params the same way PDO does #7903
Copy link
Copy link
Closed
Description
Description
The following query work with PDO:
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:
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
MySQL Server 5.6, 8.0
Operating System
Windows, linux
Reactions are currently unavailable