Loading

Simple Chat System Using PHP/MySQL with ajax

Submitted by: 
Language: 
Visitors have accessed this post 43405 times.


This code will tech you on how to create a simple chat system using php and ajax. The feature of this code is it allow multiple user to send message to each other. Download this code to see how this chat function.

database name: chat




Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

I tried this it is working but the problem for me is it's refreshing the page every time .I want to work this chat code without refreshing the page..please help

Can you play sound when new entry added?

Thank's nice bangetz

I can't download it because I'm on a Nintendo 3DS, and so I was wondering if you could put it on my site that would be great -Thanks Emolga

argie's picture

sure i will, add me o facebook: policarpio.argie@yahoo.com

Thank u

Not working
Showing error..Notice: Undefined variable: sender in E:\wamp\www\simplechat\index.php on line 107 Call Stack #TimeMemoryFunctionLocation

sir thankyou so much,.. im a filipino but i have a little bit question,, why is it evrytime i refresh the page even there is a require="required" in my input type. it posting again and again my email thugcie@yahoo.com thank your i hope you will send me a feed back.

Nice chat. I am going to create my own chat. I have a problem with refreshing. Can I use your ajax refresh code in my project?
Best regards.

You are save my time awesome

here u use the post method and call insert in the same page, the save.php is not working. .click() is not being called.

When page refresh repeat the last entered text, how can we avoid this
any way very useful.

thanks

hi thanks for your code . may i hav request ?

elmar's picture

why is it that everytime i reload the page, it will repeat the message i send.?

I changed php file to support my DB server and file server. The error always happens:
Could not connect: Access denied for user 'root'@'localhost' (using password: NO)
My user isn´t root anymore. So, do I need make some change in js files?

Solved! Index.php has 2 calls to mysql_connect!
Thank you for the solution!

It is showing the error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\chat\chat\refresh.php on line 13 please tell me the solution for it.

Add new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
To prevent automated spam submissions leave this field empty.

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.