php - Fetch unique data from db -
i've db column named "alerts" in table named "users" data of alerts each user has been entered like;
usera -> 1,2,3,4,5,6 userb -> 33,44,22 userc -> 333,444,555
the comma separated numbers pid (post id)
now want fetch users having "pid" e.g. 444
i'm using query;
$query = $db->query("select uid users alerts '%{$pid}%'"); $uid = $db->fetch_array($query);
now issue is, fetch users not unique. example if i'm searching pid = 444 fetches users having "4" in alerts column. how should go searching unique users?
use this:
$query = $db->query("select uid users find_in_set('{$pid}',alerts);
Comments
Post a Comment