leafsphp / db

🗄 Leaf PHP db module
https://leafphp.dev/modules/db/
6 stars 8 forks source link

SQLSTATE[42000] when using integer variables in bind method. #20

Open rohit267 opened 4 days ago

rohit267 commented 4 days ago

Describe the bug

$offset = ($page - 1) * 10;
$notices = db()->query('SELECT id, topic, address, date FROM notice ORDER BY id DESC LIMIT 10 OFFSET ?')->bind($offset)->fetchAll();

Results in:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''0'' at line 1

To Reproduce

Use the above code.

Expected behavior

It should correctly bind the integer variables to the sql query.

mychidarko commented 4 days ago

@rohit267 will look into this