In this chat app, when you open it first on your browser, there is shown a signup form where you have to signup with your details like name, email, password, and image. Email and image field is fully validated which means you've to enter a valid email and an image file only. Once you signed up successfully, you'll be redirected to the user's page where you can see your full name, image, status, and logout button to the top, and users, like you, appear on the bottom if someone has signed up. On this page, you can see their image, name, status, and the last message if they sent to you. You have to click on the particular user or you can also search any existing user with their name then you'll be redirected to the chat page and there you can see the image, name, status of that user who is going to chat.
Once you send a message to another user then immediately that message appears in your chat box and another user chatbox too which you've sent the message. On the message receiver chatbox, this user received the message with the sender image. Remember chatbox will be automatically scrolled to the bottom once the chatbox starts scrolling. You can logout from the chat application at any time and once you logout, immediately all other users will know that you've been log out or offline.
Once you logout, you can again login and with your email and password that you used to when signing up for the form. If you entered the correct credentials then you'll be redirected to the user's page and all other users will immediately know that you've logged on and now active.
Video Tutorial of Realtime Chat Application using PHP
In the video, you've seen the demo of the chat app and the codes or concepts behind creating a chat app. As I already told you I used PHP with MySQL and pure JavaScript Ajax to create this chat app so you don't need to reload the page to see changes in the chat app. I know if you're a beginner and you don't have enough knowledge about PHP then definitely you've to difficult to understand the codes.
But I tried to explain each JavaScript and PHP line with comments, subtitles, etc. But don't worry I have provided the source code files of this chat app so you can easily download from the given download button and try analyzing, practicing the codes to understand better. And I know, there are many other features that are missed on this chat app but for now, I think it is more than enough for practice.
You might like this:
Realtime Chat Web Application [Source Codes]
How to download source code files and what to do after downloading them?
Steps: - To download files, just click on the given green color button then you'll be redirected to the timer page, just wait for the timer. Once the timer completed then a zip file will be automatically downloaded. Once it downloaded, just extract the zip file then you'll see the folder name with ChatApp. Copy this folder and paste it inside htdocs folder of your XAMPP then start your apache and MySQL from the XAMMP control panel. After completing these steps, go to your browser and open this URL localhost/phpmyadmin then create a new database name with chatapp. After creating the database, there you can see an import option, just click on that and import the SQL file which is in the ChatApp folder. Everything is done now, just open this URL localhost/chatapp that's it. Your chat application is ready to chat.

Giving a Eror massage when giving image
ReplyDeleteWarning: move_uploaded_file(images/1613574012IMG-5f8954caa02539.76436861.jpg): failed to open stream: No such file or directory in G:\aiman study\htdocs\new team\register\ChatApp\php\signup.php on line 27
Warning: move_uploaded_file(): Unable to move 'G:\aiman study\tmp\phpBCBB.tmp' to 'images/1613574012IMG-5f8954caa02539.76436861.jpg' in G:\aiman study\htdocs\new team\register\ChatApp\php\signup.php on line 27
Please try again. Maybe you deleted images folder which is inside ChatApp>php
DeleteThanks bruh
ReplyDeleteYou're welcome :)
Delete
DeleteNotice: Undefined index: incoming_id in C:\xampp\htdocs\ChatApp\php\get-chat.php on line 6
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\ChatApp\php\get-chat.php on line 12
No messages are available. Once you send message they will appear here.
ReplyDeleteNotice: Undefined index: incoming_id in C:\xampp\htdocs\ChatApp\php\get-chat.php on line 6
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\ChatApp\php\get-chat.php on line 12
No messages are available. Once you send message they will appear here.
Codes now updated. Please download files again from the same link.
DeleteI just downloaded the code, but it is saying the same thing
DeleteThis comment has been removed by the author.
ReplyDeleteCodes now updated. Please download files again from the same link.
DeleteThanks!🤩
ReplyDeleteYou're welcome :)
Delete
ReplyDeleteWarning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
please help
Codes now updated. Please download files again from the same link.
Deleteif you find this error again just replace line 14 in data.php file with ($outgoing_id == isset($row2['outgoing_msg_id'])) ? $you = "You: " : $you = "";
DeleteBTW CodingNepal your work is amazing.
Now I have You: in every message in second row, don't know why man
Delete
ReplyDeleteWarning: Undefined array key "incoming_id" in E:\xampp\htdocs\ChatApp\php\get-chat.php on line 6
Codes now updated. Please download files again from the same link.
Delete
ReplyDeleteWarning: Undefined array key "incoming_id" in E:\xampp\htdocs\ChatApp\php\get-chat.php on line 6
Codes now updated. Please download files again from the same link.
DeleteGiving error' message When open file chat.php?user_id=....
ReplyDelete⏬⏬⏬⏬⏬⏬⏬
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /storage/emulated/0/htdocs/chatapp/chatapp/php/get-chat.php on line 12
Codes now updated. Please download files again from the same link.
DeleteHey, when I go to open the conversation, the messages do not appear and I appear to say that there are errors on line 6 and 12 (get-chat.php) and a fatal error. How can I solve?
ReplyDeleteCodes now updated. Please download files again from the same link.
DeleteImpressive tutorial Master 💝
ReplyDeleteThank you too much :)
DeleteThis work is really fire! Thank you so much. CodingNepal.
ReplyDeleteYou're most welcome :)
Delete
ReplyDeleteWarning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\ChatApp\php\signup.php on line 11
Something went wrong. Please try again!
Did you follow every steps that I mentioned above?
DeleteThere is no images inside php/images
ReplyDeleteSorry but it's true
It is...I created a folder with images name inside php folder to save users uploaded images...please check again
DeleteHELLO
ReplyDeleteHi
Deletemessage not send
ReplyDeleteHave you got any error?
DeleteHi codingNepal can You include the sound .mp3 for the notification in your chatapp ???
ReplyDeleteOk. I'll do it
Deletepls vscode dont allow me to code in php pls help me!!!!!!!!!!!!!!!!!!!
ReplyDeleteWhat's the error? Can you tell me?
DeleteHi, can you put a sound for the notification ?
ReplyDeleteOk. I'll do it
DeleteBrother, I have a problem! All details are perfect, but the connection was not a success.
ReplyDeleteThe Error: "Warning:mysqli_connect(): (HY000/1045): ProxySQL Error: Access denied for user 'id16130301_tawfik'@'2a02:4780:bad:f00d::3' (using password: YES)"
Please help me. How can I solve this?
This error you faced because you've written dbname or dbpass or dbuser name incorrectly in config.php. But if you were written all things correctly then delete the current database and create another one because this is a free hosting and sometimes you get an error even if you did everything perfectly.
Delete
ReplyDeleteWarning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\ChatApp\php\data.php on line 14
Its showing this i wanted the reference code but its not working idk why its showing this i ve downloaded it today 2 / 22 /2021 ( can you help me please )
I think you changed the PHP codes so you're facing these errors.
DeleteWhy is this showing something like XAMP / some folder
ReplyDeletecan you help me idk why i am getting this
You meant when you uploaded it to an online server, there you're getting this right?
DeleteSir please add password change and profile change option.
ReplyDeleteSure. Updates will come soon.
DeleteSir please add password reset and profile pic reset option in this chat.
ReplyDeleteThis chat very nice
Sure. Updates will come soon.
DeleteWhy is show me like this: Trying to access array offset on value of type null in C:\xamp\htdocs\ChatApp\php\data.php on line 14
ReplyDeletePlease contact us here - codingnepalweb@gmail.com
Delete
ReplyDeleteWarning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /storage/ssd4/625/16245625/public_html/php/signup.php on line 11
Something went wrong. Please try again!
Please contact us here - codingnepalweb@gmail.com
DeleteActually I repoted it a littli late.
DeleteNow i dont get this error but now I have another error i have reported it in these comments
Hello there;
ReplyDeleteI downloaded the source codes. I edited the config.php file with my own information. But do you know the reason I got this error? Note: I get an error like this when a second user is online. The online user does not appear. You can reach for a reply at oglcn007@gmail.com. Thx
Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\chat\php\data.php:7 Stack trace: #0 C:\xampp\htdocs\chat\php\data.php(7): mysqli_fetch_assoc(false) #1 C:\xampp\htdocs\chat\php\users.php(11): include_once('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\chat\php\data.php on line 7
Please share the screenshot of your problems here - codingnepalweb@gmail.com and also explain when you're getting this error?
Deletehow do i sort user in the user.php by incoming_msg_id
ReplyDeleteCan you explain more?
DeleteDatabase connection errorNo such file or directoryAll input fields are required!
ReplyDeletePlease help CodingNepal
Database connection errorNo such file or directory
ReplyDeletePlease answer fast what to do
hi can you make a tuto about how you can send a message in chat? and add reset pass thanks, new subscriber
ReplyDeleteHi sir I want to add your code in our project but this case I'm already login.so how can set plz explain.
ReplyDeletei want to show user list according to the last received or outgoing message (like fb) and also i want seen or unseen msg tab (read or unread also okay )
ReplyDeletei am waiting forr the update, can you plz tell when exactly we get next update ? this is cool
I really like your all tutorial . Your work is awesome. Please put the demo of each tutorial with download. Thank you very much
ReplyDeleteCan I use this code on my website.
ReplyDeleteHello Coding Nepal, thanks for the code, it is really useful.
ReplyDeleteI have a problem to register, it does not show what the error is, but I believe the problem is in the image upload.
Because I put the image in the images folder, and entered the data manually in the database and it worked.
Do you know what the possible error is?
hi, thanks for script.I install the script, everything ok. but not registering.when open the console this alert seen,[DOM] Input elements should have autocomplete attributes (suggested: "current-password"): (More info: https://goo.gl/9p2vKq) input type="password" name="password" placeholder="Enter new password" required=""
ReplyDeleteI take console alert
ReplyDelete[DOM] Input elements should have autocomplete attributes (suggested: "current-password"): (More info: https://goo.gl/9p2vKq) input type="password" name="password" placeholder="Enter new password" required=""
You know? You make me surprise every time! Thank you!
ReplyDeletehow to open it i am not getting
ReplyDeleteYou have a error when render user image account who send a message. receiver user show samself image but not sender. You need a change SQL query on file get-chat.php from ... users.unique_id = messages.outgoing_msg_id ... to ... users.unique_id = messages.incoming_msg_id ...
ReplyDeletehow can i add this chat box in xml blogger website.
ReplyDeleteIt Works perfect in my localhost thanks bro
ReplyDeleteWhat are softwares we should download to run this sir?
DeleteHello! Can you add file sending to chat? Please
ReplyDeleteHello good evening, please can you do a tutorial on how to make the chat application mulitilingual.
ReplyDeleteAmazing man!! You do a lot of work for the society.
ReplyDeleteCould you give me database for this
ReplyDeleteI have successfully installed your chatapp.
ReplyDeleteExcept when I want to create a user or log in. It gives me no error, but no page loads. However, to verify the connection to the database, I created a user from the database, and when I want to create an account, it tells me "Email already exists". I therefore conclude that the connection to the database is successful.However, I don't know where the error came from.
It's working great... Thanks
ReplyDeleteNot Found
ReplyDeleteThe requested URL was not found on this server.
Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.0.3 Server at localhost Port 80
Bonjours
ReplyDeleteje voudrais savoir comment je peux faire pour retirer l'obligations de mettre une photo
merci
Hello
ReplyDeleteI would like to know how to remove the obligation to import an image
thank you
It is good.❣️
ReplyDeleteSomething went wrong. Please try again! this is the error am getting
ReplyDeleteencrypt the message from the database and retrieve them in the chat
ReplyDeleteI can't Connect SQL.
ReplyDelete"
Database connection errorAccess denied for user 'root'@'localhost' (using password: NO)All input fields are required!
"
"403 access denied "Bhai Please Bro help Me on this.
ReplyDeleteBro it works fine but its not working after
ReplyDeleteIts working fine on local host but not working on web it shows "403 access denied " can you help me with that
ReplyDeleteI am getting this error
ReplyDeleteWarning: move_uploaded_file(images/1618997904lesson.jpg): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/ffyypp/ChatApp - CodingNepal/php/signup.php on line 28
Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpmTMVIx' to 'images/1618997904lesson.jpg' in /Applications/XAMPP/xamppfiles/htdocs/ffyypp/ChatApp - CodingNepal/php/signup.php on line 28
Tell me sir,what r the softwares should download sir ?for this project
ReplyDelete403 forbidden chat.php
ReplyDeleteThanks
ReplyDeleteHello coding Nepal, I have uploaded this project on server on infinityfree server.
ReplyDeleteWhenever I open chat it shows a popup "website configuration prevents to access this page"
Here is my website url
http://whatschat.epizy.com/
Please help me
I have uploaded this project on infinityfree server.
ReplyDeleteWhenever I open a chat it redirect me on error page "website configuration prevents to access this page"
My website url http://whatschat.epizy.com/
Help me out
Post a Comment
We welcome relevant and respectful comments. Off-topic or spam comments may be removed.