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

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?

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

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 [email protected] 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 ?

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

The browser reloads the page but saves any data entered. It then resends the data to the website. In firefox, it always asks if you want it to resend the info.

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.

In reply to by Nikhil Kappad (not verified)

I get the same error, help..?

Thank u friend ....?

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

( ! ) 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

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.

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