Ok so here we go..
Lets say $topic['is_new']
consists of "7325823" and accID is 63426 then it updates to 7325823|63426 but if I reload the page again it removes 7325823| so its only 63426. I don't want that.
Whats wrong? can't figure it out
$accID = userid goes here;
$topic['is_new'] = "72482|81249|8124|42534|...and so on"; // user ids that i get from field in topics table
$list_of_ids = explode('|', $topic['is_new']);
// lets see if the user has already been here
if (!in_array($accID, $list_of_ids)) {
$in = isset($topic['is_new']) && !in_array($accID, $list_of_ids) ? $topic['is_new'].'|'.$accID : $topic['is_new'].'|'.$accID;
} else {
// if he havent, add him to the list
$in = $accID;
}
// yes i know, PDO is better
mysqli_query("UPDATE topics
SET num_views = num_views+1, is_new = '$in'
WHERE id = $tid") or die(mysqli_error($link));
This is what I'm trying to implent: custom php forum - showing new/unread posts