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 4610966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:12:16+00:00 2026-05-22T01:12:16+00:00

So I created a chat with jquery php and mysql.. It also uses ajax.

  • 0

So I created a chat with jquery php and mysql.. It also uses ajax. So here is the code

The PHP process page:

$result = mysql_query("SELECT *
                         FROM messages 
                     ORDER BY id DESC  
                        LIMIT 30") or die(mysql_error());

while($row = mysql_fetch_array($result)) {
  if($row['correct'] == 1) {
    $correct = "<font color='green'>";
  } else {
    $correct = "<font color='red'>";
  }

  echo $correct;
  echo $row['name']. ": ". $row['message'] . "</font>";
  echo "<br />";
}

My jquery on the index page looks like this

$(document).ready(function() {
  $('form[name=answer]').submit(function() {
    validate();
    return false;
  });

function validate() {
  $.post("http://localhost:8888/school/procees.php", 
          {answer: $('input[name=answer]').val(),
          questionid: $('input[name=questionid]').val(), 
          name: $('input[name=id]').val()}, 'json');
}

setInterval(function() { 
  $('#about').load('maketable.php');
}, 1000);

});

I understand that running a check and then printing everything out requires takes a lot of memory I do not know how to do it any other way. Suggestion and criticism of the code is welcome. How can I improve it?

  • 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-22T01:12:17+00:00Added an answer on May 22, 2026 at 1:12 am

    there’s other code you are using here which might/might not help – what I would say is that if this is live chat consider using the MEMORY table type in mysql – it has very fast reads which makes it a good candidate for this type of application.

    Make sure your ajax requests only ask for data that you haven’t already loaded – that may help.

    If you need more help we’d need to see the maketable.php code too..

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

Sidebar

Related Questions

I'm using PHP, AJAX, a MySQL database, and a lot of jQuery to prototype
newbie here. I successfully created a chat server using c# (server partial code below,
I have created a page index.php with a lot of divs and I need
I created a small chat application in Sinatra and jQuery on heroku. It simply
I have created a chat application using PHP, but it works only into my
I am trying to create a simple ajax chat using JQuery and ASP.NET. My
I am trying to create a little ajax chat system (just for the heck
I'm trying to build a site that runs without refreshes, using Jquery and PHP
Here is my current problem. I am working with the chat module and I'm
I created a chat application and seems to work just fine except that it

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.