I am trying to search data from my mysql table. Table field type is text. My fields and data like:
When I am trying to query like:
SELECT * FROM `packages` WHERE `assign_div` LIKE "%1%" AND `assign_dist` LIKE "%1%";
it brings up all other data like "10", "51", "21" and so on (cos i have used "%%").
How can i arrange my query that only brings the passed data or what will be the best way to convert those string array data and search?
CodePudding user response:
You need to add "
to specify the accurate value
SELECT * FROM `packages` WHERE `assign_div` LIKE "%1%" AND `assign_dist` LIKE "%\"1\"%";