I'm experimenting with a simple HTML5 local storage based app and I'm having trouble with the parameter replacement escaping (maybe) in my code.
The SQL line I want to execute is:
SELECT name, title FROM testTable WHERE name LIKE '%test%';
so my Javascript line is something like:
tx.executeSql( "SELECT name, title FROM testTable WHERE name LIKE '%?%'", [ search_string ],
This fails (I think) because the ? is being treated as a literal and so the parser complains about too many parameters (search_string).
I optimistically tried using ??? and ["'%", search_string, "%'"] but same result.
Any suggestions - I imagine it's something really obvious so please be gentle.
How about:
tx.executeSql(
"SELECT name, title FROM testTable WHERE name LIKE ?",
[ '%'+search_string+'%' ]
);
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