Jump to content

Instant Messenger Updater


shane18

Recommended Posts

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.