I'm trying to do MySQL query to extract specific rows without the help of PHP if conditions,
okay,
i want to select a row where the variable is not in a specific row but here's the thing
$blocked_user = "aaron";
and in MySQL
+----------+-----------------------+
| id | blocked |
+----------+-----------------------+
| 1 | aaron,john |
i want it to skip "aaron" while selecting and process to john
a false example :
SELECT * FROM table WHERE $blocked_user NOT IN blocked
What i was doing is get blocked content and seperate them using php explode function then using in_array and if to confirm its not there :
if(in_array($blocked_user, explode($row['blocked'])){
exit;
}
but now i want to get rid of this and do it using a single query, how is it done ?