I have code that supposed to show new items in menu (right of the items.php url). That's not working at all or it shows only one item though there is 10 items. It count's new items and check when your last browse. When you refresh items page "New item-tag" disappear.
So if you can help me I'm very thankfully :)
Code:
$res = mysql_query("SELECT last_visit
FROM users
WHERE id='".$user['id']."'");
$arr = mysql_fetch_row($res);
$last_visit = $arr[0];
$time_now = gmtime();
if ($last_visit > $time_now)
{
$last_visit = $time_now;
}
$results = mysql_query("SELECT COUNT(*)
FROM items
WHERE added >= '".$last_visit."'");
$num_rows = mysql_num_rows($results);
$all = number_format($num_rows);
while ($num_rows = mysql_fetch_assoc($results))
{
if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_visit)
{ ?>
<li><a href="items.php">Items<br />(<font color="red"><?php echo $all ?> new items</font>)</a></li>
<li><a href="items.php">Items</a></li>