In one of my tables, i have a column where it has a comma seperated list of users that have bought that item. IMAGE
How can i read the list and run a php script to find
Use FIND_IN_SET() to find the records that contain your user
select *
from your_table
where find_in_set('MTNOfficial', usersBought) > 0
Get the comma separated list, then try the php function explode() to get an array that you can loop over.
http://php.net/manual/en/function.explode.php
$target = "MTNOfficial";
$query = "select usersBought from table_name";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$users = explode("," $row['usersBought']);
// may want to trim() here
for ($i = 0; $i < count($users); i++) {
if ($users[i] == $target) {
//we found him!
}
}
}