Reputation: 1945
I am making a search
function and I need to search using two inputs:
the category id (CID) it is a string that is contained (or not) in KEY_P_CAT_LIST (it cant be done with = as it usually isn't equal)
the search text input (input)
I need to check if the category and the input text is contained in the db record and return it in a cursor if so.
coloane is correctly defined as a []
String and is not the problem.
My atempt:
db.query(true, P_TABLE, coloane,KEY_P_CAT_LIST + " LIKE " + " AND " +CID + " LIKE", new String[] {"%"+CID+"%", "%"+input+"%"}, null, null, null, null);
Upvotes: 0
Views: 946
Reputation: 3130
Try this:
db.query(true, P_TABLE, coloane,KEY_P_CAT_LIST + " LIKE ?" + " AND " +CID + " LIKE ?", new String[] {"%"+CID+"%", "%"+input+"%"}, null, null, null, null);
Hope it Helps!!
Upvotes: 1