I am a Programmer learner.
I want to get MySQL query in following format
select status from training where status in ("Open", "Delivered")
from my code
if(params.openCheckBox){
query +=" ( t.status IN ("+params.openCheckBox+", "+params.DeliveredCheckBox+")"
query +=" )"
}
but it gives
select status from training where status in (Open, Delivered)
Here “” (double quote is missing)
escape double quotes with
\, MySQL Accepts double quotes to wrap strings.or
just use single quote
the query above is vulnerable with
sql injection. make use ofPreparedStatementlike the one belowCode Snippet:
SOURCES