shane18 Posted February 10, 2010 Share Posted February 10, 2010 $CURRENT_TIME = time() + 3600; $FROM = $DATABASE_LINK->query("SELECT `name` FROM `users` WHERE `id` = '{$_SESSION["USER_ID"]}'"); $FROM = $FROM->fetch_object(); $MESSAGES = $DATABASE_LINK->query("SELECT `from`,`content` FROM `messages` WHERE `from` = '$FROM->name' && `to` = '{$_GET["WITH"]}' && `sent` >= '{$_SESSION[$SWITH]}' || `from` = '{$_GET["WITH"]}' && `to` = '$FROM->name' && `sent` >= '{$_SESSION[$SWITH]}' ORDER BY `sent` ASC"); $SWITH = $_GET["WITH"]; $_SESSION[$SWITH] = $CURRENT_TIME; while($MESSAGE = $MESSAGES->fetch_object()){ echo "$MESSAGE->from : $MESSAGE->content<br>"; } This code should get any messages since the last update timestamp which is stored in a session... but for some reason it lists every message every time... Link to comment https://forums.phpfreaks.com/topic/191576-instant-messenger-updater/ Share on other sites More sharing options...
shane18 Posted February 10, 2010 Author Share Posted February 10, 2010 lol I had $SWITH = $_GET["WITH"]; below the query... fail lmao Link to comment https://forums.phpfreaks.com/topic/191576-instant-messenger-updater/#findComment-1009877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.