Consider I have a table like this.
+-------------+---------------+----------------+---------------+ + id + column 1 + column 2 + column 3 + +-------------+---------------+----------------+---------------+ + 1 + values + values + a, b, c, d, e + +-------------+---------------+----------------+---------------+
My query can be like this
SELECT * FROM table WHERE column 1 = 'values' AND column 3 = '$variable'
The $variable can be anything from a to e
Is there a way to use query to select the row the I want?
use FIND_IN_SET()
-- a builtin function for mysql to search a string
SELECT *
FROM tableName
WHERE column 1 = 'values' and FIND_IN_SET('a',column 3 )>0
sample
REFER
Try this
SELECT *
FROM table
WHERE FIND_IN_SET('$variable', column 3)
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