0

Im thinking about taking on a chat room php based project. I want to make sure my logic is right though. This is very raw so please feel free to contribute if you see any problems that might occur.

MYSQL

TABLES
Username
chatroom1
chatroom2
etc..

PHP

Sign up.php
Insert username and password into Username table.

Login.php
Search Username table to validate username and password. Create session.

chatroom1.php
enter message into chatroom1 table. Retrieve messages periodically by new message entered organized by timestamp.

Edited by RazorRamon: n/a

4
Contributors
5
Replies
8
Views
6 Years
Discussion Span
Last Post by FreddieBambino
0

Ajax. For periodic calls to DB.

seems OK. Do you really need to create a chatroom table every time? Depends on your structure I suppose. Can users create their own chatrooms or are there a few that will be available to them?

0

I wanted to have a fix number of rooms. I know Yahoo got in trouble a few years ago with the creation of new chat rooms by users on yahoo messenger. I know creating a new table isn't very difficult though.

I am very green when it comes to javascript and ajax. I'm a lil intimidated actually. I understand the concept of ajax but dont really understand on how to call a database with it in conjunction with php.

0

You won't be able to make a chat for php without ajax.

If you use jQuery, it should be quite easy.

0

You dont need to create a chatroom table everytime there is new chat launched. Ive never programmed a chatroom but I would guess the database would rather be two tables.
1st table for a chats with columsn for example: "id, created_by, launched, chat_title".
2nd table is all the comments with columns like, "idnumb, chatid_FK(referencing the 1st table and linking the id together), comment, user.
3rd table would then obviously be the users info like userid, username, password etc.

Then the ajax query queries the database with something like: "select chat_title, idnumb, comment, name from chat_table, comment_table, user_table where chat_table.id = '35' and userid = column_table.user offset 0 limit 20 order by idnumb desc

This would then fetch the last 20 comments, usernames for the comments, title of the chat.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.