$sql = 'select name from user_account where email=?';
$stmt = $db->prepare($sql);
$stmt->bindParam(1, $email, PDO::PARAM_STR);
But it's throwing an exception:
PDOStatement->bindParam() @swoole-src/library/core/Database/PDOStatementProxy.php:138
PHP TypeError: PDOStatement::bindParam() expects parameter 1 to be string, int given in @swoole-src/library/core/Database/PDOStatementProxy.php on line 138
I suspect that __object in abstract class is the cause. Another way is working fine:
$sql = 'select name from user_account where email=:email';
$stmt = $db->prepare($sql);
$stmt->bindValue('email', $email, PDO::PARAM_STR);
I'm using the following swoole:
$ php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.6.7
Built => Jul 14 2021 09:18:38
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
I am used to coding:
But it's throwing an exception:
I suspect that __object in abstract class is the cause. Another way is working fine:
I'm using the following swoole:
Thank you.