从MYSQL中搜索数组

I need to search for user ID through the arrays outputted from Mysql exploded table. I have tried an search a lot know but can't find a solution. Here is the code the ID I will search is ID 3

while ($row = mysqli_fetch_assoc($query)) {
    $shares = explode(',', $row['share']); # MAKE THE TABLE INTO AN ARRAY
    print_r($shares);
}

Output

OUTPUT

does key indexed 1 exists AND has value equal to three?

...while & explode
if(isset($shares[1]) && $shares[1] === 3)

but i would suggest you change the way you get data from your database. you should have share value in column selected as share and id in column id.

so you could do something like:

while ($row = mysqli_fetch_assoc($query)) {
    if ($row['id'] === 3) {
           //do stuff
    }
}