Here's my SQL:
SELECT * FROM users WHERE username LIKE "%?%" LIMIT 25;
And it gives me this error:
SQLITE_RANGE: column index out of range
I looked into a bunch of github issues but couldn't find any that works for me.
In the SQLite CLI it works, so I have no idea why it wouldn't work here.
A ?
inside a string like "%?%"
is not considered as a placeholder for the parameter that you pass, which throws the error that you get because the parameter has no where to be placed in the statement.
Use concatenation of the ?
with the wildcards:
SELECT * FROM users WHERE username LIKE "%" || ? || "%" LIMIT 25;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With