How do I make a chat with AJAX and PHP?

Get help using Construct 2

Post » Sat Jul 01, 2017 12:29 am

Hi, after trying out the chat template with the Multiplayer Plugin I decided I wanted to look for some alternatives. And I thought, if you can create (for example) a login system with a database in a server, some PHP and the AJAX object, you would probably also be able to make a chat like this.
If this is possible, I assume it will work muuch better than a chat with the Multiplayer Plugin (well, this isn't really difficult :lol: ). And here comes my question: how would you do this?
I had imagined you would have to create a database with three columns (ID of the message, Username and message) and then every single message would become a row in the database (after sending the message to the database via AJAX). But this doesn't seem very clean to me: if you have e.g. 4k messages, would this mean your database would have also 4k rows?
Can you exchange this huge amount of data with the AJAX object (POST/GET)?
Else, how can you make the capx to automatically "download" a new message whenever another user sends a message (eventually whenever a new row is added to the database)?

Thank you for your help :)
Posts: 168
Reputation: 1,925

Post » Wed Jul 05, 2017 3:41 pm
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
Posts: 1,419
Reputation: 4,867

Return to How do I....?

Who is online

Users browsing this forum: DarthPapalo666 and 57 guests