Ok, i used "LIKE" with "LEFT JOIN" and it works fine.
$sql = $conn->query("SELECT * FROM tasks t
LEFT JOIN users u
ON t.allowed_countries LIKE u.country
WHERE u.username = '$username'");
but when i'm try to use "LIKE %%" instead of using "LIKE" then it gives me error
LIKE '%" u.country "%'
Can anybody tell me the problem please?
Thank you.
USE concat
as % is a char literal.
LIKE concat('%',u.country,'%')
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