So I'm having a weird issue that I just can't quite figure out. I have a code snippet, that renders properly on some pages, but completely different on other pages. What even makes it more weird is that on the same page that it renders properly for one user, it renders completely different for another logged in user.

My mind is boggled. I can't quite figure out why it would show properly for one user, but not for another on the exact same page. When the code is viewed on desktop, is when this happens. If viewed on mobile, it works as it should. Here is the code snippet:
echo "<div class='col-xs-6'>";
$rs = DB::Query("SELECT count(id) AS cnt FROM notifications WHERE (user_id=".$_SESSION["user_id"]." AND status = '0')");
$data = $rs->fetchAssoc();
if($data["cnt"]>0){
echo "<div class='dropdown'>";
echo "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
echo "<span class='fa fa-bell fa-2x' style='color:#01a9ac;' id='span_alert_notify'></span>";
echo "<span style='color:white; position:relative;font-size:9px;top:-18px;left:-12px;background-color:red;padding:1px 5px'>".$data["cnt"]."</span>";
echo "</a>";
echo "<ul class='dropdown-menu' style='margin-top:10px'>";
$rs2 = DB::Query("SELECT * FROM notifications LEFT OUTER JOIN website_users ON notifications.posted_by = website_users.id LEFT OUTER JOIN notifications_data ON notifications.`type` = notifications_data.id WHERE (notifications.user_id = ".$_SESSION["user_id"]." AND notifications.status = '0') ORDER BY posted DESC LIMIT 10");
while($notifications = $rs2->fetchAssoc())
echo "<li ><a role='menuitem' href='".$notifications["url"]."".$notifications["id_key"]."&viewed=1' style='font-size:12px'><b>".$notifications["displayname"]."</b>".$notifications["text"]."</a></li>";
echo "<center><b><a role='menuitem' href='Notifications_list.php'>View All Notifications</a></b></center>";
echo "</ul></div>";
} else {
echo "<div class='dropdown'>";
echo "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
echo "<span class='fa fa-bell fa-2x' style='color:#01a9ac;' id='span_alert_notify'></span>";
echo "</a>";
echo "<ul class='dropdown-menu' style='margin-top:10px'>";
echo "<center><b><a role='menuitem' href='Notifications_list.php'>View All Notifications</a></b></center>";
echo "</ul></div>";
}
echo "</div>";
echo "<div class='col-xs-6'>";
$rs3 = DB::Query("SELECT count(id) AS unread FROM messages_notifications WHERE (recipient = ".$_SESSION["user_id"]." AND viewed = '0')");
$messages = $rs3->fetchAssoc();
if($messages["unread"]>0){
echo "<div class='dropdown'>";
echo "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
echo "<span class='fa fa-envelope-o fa-2x' style='color:#01a9ac;' id='span_alert_notify'></span>";
echo "<span style='color:white; position:relative;font-size:9px;top:-18px;left:-12px;background-color:red;padding:1px 5px'>".$messages["unread"]."</span>";
echo "</a>";
echo "<ul class='dropdown-menu' style='margin-top:10px'>";
$rs4 = DB::Query("SELECT * FROM messages_notifications LEFT OUTER JOIN website_users ON messages_notifications.sender = website_users.id LEFT OUTER JOIN notifications_data ON messages_notifications.`type` = notifications_data.`type` WHERE (messages_notifications.recipient = ".$_SESSION["user_id"]." AND messages_notifications.viewed = '0') ORDER BY received DESC LIMIT 10");
while($unread = $rs4->fetchAssoc())
echo "<li><a role='menuitem' href='".$unread["url"]."".$unread["message_id"]."&viewed=1' style='font-size:12px'><b>".$unread["displayname"]."</b>".$unread["text"]."</a></li>";
echo "<center><b><a role='menuitem' href='Inbox_list.php'>Go To Inbox</a></b></center>";
echo "</ul></div>";
} else {
echo "<div class='dropdown'>";
echo "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
echo "<span class='fa fa-envelope-o fa-2x' style='color:#01a9ac;' id='span_alert_notify'></span>";
echo "</a>";
echo "<ul class='dropdown-menu' style='margin-top:10px'>";
echo "<center><b>No Unread Messages</b></center>";
echo "<center><b><a role='menuitem' href='Inbox_list.php'>Go To Inbox</a></b></center>";
echo "</ul></div>";
}
echo "</div>";