Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4332440
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:15:24+00:00 2026-05-21T10:15:24+00:00

I’m trying to create a sort of chatbox system with PHP/MySql and AJAX but

  • 0

I’m trying to create a sort of chatbox system with PHP/MySql and AJAX but I’m having difficulties running my script in IE. I tested it in Google Chrome and it worked just fine. But when I test it in IE, the AJAX function that should get all messages from the database each 3 seconds, doesn’t work properly. It does call the PHP script each 3 seconds and put the responseText into a div (displaying all messages found each 3 seconds). But the messages shown, are the same always ( untill I close the page and re-run the script ). Also when a new message is added to the database, it does not show up. It seems as if the responseText isn’t ‘updating’. These are my scripts:

(AJAX)

function getMessages(messengerid, repeat)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("messages").innerHTML=xmlhttp.responseText;
    document.getElementById("messages").scrollTop = document.getElementById("messages").scrollHeight;
    }
  }
xmlhttp.open("GET","modules/get_messages.php?key=abcIUETH85i236t246jerst3487Jh&id="+messengerid,true);
xmlhttp.send();
if(repeat) {
    setTimeout("getMessages("+messengerid+", 1);", 3000);
}
}

(PHP/MySql)

<?php
$key = "abcIUETH85i236t246jerst3487Jh";

if( ($_GET['key'] == $key OR defined('IS_INTERNAL')) AND (int)$_GET['id'] > 0) {

    include_once("../config.php");
    include_once("../class/system.class.php");

    $sys = new system($template_name);

    if(!$sys->connect($db)) {
        exit();
    }

    $messages = $sys->getEntries("messages", " WHERE messenger_id = '".(int)$_GET['id']."' ORDER BY id ASC ");
    $messenger    = $sys->getEntries("messengers", " WHERE id = '".(int)$_GET['id']."' LIMIT 1");

    $user1 = $sys->getEntries("accounts", " WHERE id = '".$messenger[0]['account_id1']."' ");
    $user2 = $sys->getEntries("accounts", " WHERE id = '".$messenger[0]['account_id2']."' ");

    $displaynames[$user1[0]['id']] = $user1[0]['displayname'];
    $displaynames[$user2[0]['id']] = $user2[0]['displayname'];

    foreach($messages AS $key => $message) {

    if(is_numeric($key)) {              
    ?>
    <div class="message">
        <b><?=$displaynames[$message['account_id']];?>  (<?=date("h:m:s", $message['timestamp']);?>) says:</b> <br />
        <?=nl2br($message['message_content']);?>
    </div>
    <?php
    }
    }


}

?>

Any help would be much appreciated!
Thanks in advance.

Best Regards,
Skyfe.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:15:25+00:00Added an answer on May 21, 2026 at 10:15 am

    Your response is being cached. One way to fix this is to append a unique parameter in your request URL, such as the current timestamp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am trying to understand how to use SyndicationItem to display feed which is
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.