So I have a database column where it has like past usernames.
This is what the row would look like if it had info.
bill, joe, ryan
What I am trying to do is check ever single row and check if like any of them contain joe. I have one possible theory on how to do it but what I fear is say someones past username is this:
billjoe
Im afraid it would think it exists in database because of that bill in it i would want it to ignore it if its not exactly bill.
Whats confusing is it could have for example 3 names in 1 string seperated by commas.
My theory on how to do it is like this:
$stmt = $db->prepare("SELECT * FROM users WHERE pastusernames LIKE :pastusernames");
$stmt->execute(array(':pastusernames' => "%bill%"));
But that may even be totally wrong. So is there anyway to do this correctly?