Simple Chat System Using PHP/MySQL with ajax

Language

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

Submitted byAnonymous (not verified)on Thu, 03/21/2013 - 19:11

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
Submitted byAnonymous (not verified)on Thu, 04/04/2013 - 06:10

Can you play sound when new entry added?
Submitted byAnonymous (not verified)on Thu, 07/18/2013 - 04:41

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
Submitted byAlpesh paghadar (not verified)on Fri, 08/16/2013 - 17:44

Thank u
Submitted bySka (not verified)on Sun, 09/08/2013 - 15:08

Not working Showing error..Notice: Undefined variable: sender in E:\wamp\www\simplechat\index.php on line 107 Call Stack #TimeMemoryFunctionLocation
Submitted byACie (not verified)on Sat, 09/14/2013 - 00:27

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 [email protected] thank your i hope you will send me a feed back.
Submitted bymonika25257 (not verified)on Mon, 10/28/2013 - 05:56

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.
Submitted bysuseelan (not verified)on Thu, 11/14/2013 - 13:00

You are save my time awesome
Submitted by_anonymous (not verified)on Mon, 11/25/2013 - 10:24

here u use the post method and call insert in the same page, the save.php is not working. .click() is not being called.
Submitted byMalitha (not verified)on Fri, 02/07/2014 - 12:40

When page refresh repeat the last entered text, how can we avoid this any way very useful. thanks
Submitted bysasky (not verified)on Wed, 02/19/2014 - 14:51

hi thanks for your code . may i hav request ?

I haven't read the code yet but the problem with refreshing the page sounds as if the last message var isn't being cleared after it is posted. therefor when you refresh the page it is in turn resubmitting the last msg
Submitted byMaetus (not verified)on Tue, 04/01/2014 - 01:15

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?
Submitted byMaetus (not verified)on Tue, 04/01/2014 - 01:49

Solved! Index.php has 2 calls to mysql_connect! Thank you for the solution!
Submitted byNikhil Kappad (not verified)on Fri, 06/20/2014 - 19:01

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.
Submitted byRemi (not verified)on Mon, 10/06/2014 - 18:38

In reply to by Nikhil Kappad (not verified)

I get the same error, help..?
Submitted byyatashivamca@g… (not verified)on Thu, 07/31/2014 - 19:15

Thank u friend ....?

Submitted byjayaganesh (not verified)on Tue, 09/16/2014 - 19:16

awesome tutorial... being a begineer it was very useful for me

Submitted byerror. (not verified)on Sat, 09/19/2015 - 01:19

( ! ) Notice: Undefined variable: sender in C:\wamp\www\chat\chat\index.php on line 107 Call Stack #TimeMemoryFunctionLocation 10.0059378088{main}( )..\index.php:0 "/> argie helo wewew (=^_^=) argie helo argie helo wewew hi argie helo
Submitted byslimy (not verified)on Mon, 05/22/2017 - 05:43

When I write anything, it is displayed for about 1 second and then disappears followed by the message 'Could not connect: No such file or directory'. Please help.
Submitted byslimy (not verified)on Tue, 05/23/2017 - 01:33

When I write anything, it is displayed for about 1 second and then disappears followed by the message 'Could not connect: No such file or directory'. Please help.

Add new comment