473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHP-MySQL data storage for messenger program

TheServant
1,168 Expert 1GB
Hi guys,
Hope this finds you all well. I have been away (getting married and taking a break from everything) but I am back now and I have need of some more experienced php guru's:

I am trying to make an in-game chat system which will create a new chatroom when a user creates a group. I have a couple options and I want to know which is best in your opinion:

1. Create a single table for all chatrooms and include 100 columns for messages including user/time sent/message. Problems is this limits messages to 100, but also means that it is controlled and data will not get too big.
2. Create a single table for all chatrooms and simply have a text variable which will include user/time sent/message separated by a character which can be parsed to separate them and display correctly. This means relatively unlimited messages, but deleting specific messages could be a little more difficult.
3. Create a table for each chat room with user/time sent/message columns. This is the best option, but I don't really want lots of tables.
4. Create a single table for all chatrooms with group/user/time sent/message columns and then when each chatroom is called, search through the whole table to find all rows belonging to that chatroom.

If the game was successful I could be looking at over 1000 groups with maybe 10 messages per hour per group. So it could get very big. Any suggestions would be great.
Jan 15 '09 #1
2 1342
pbmods
5,821 Expert 4TB
Heya, TheServant.

So you have a number of groups, and each group has its own chat[room], which contains a number of messages.

If you don't plan on ever allowing any group to have more than one chat[room], then you can simply tag each chat message with the group for whom it was intended.

You'd end up with something like this:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `groups`(
  2.   `groupid` bigint(20) unsigned not null auto_increment,
  3.   /* extra group details */
  4.   PRIMARY KEY(`groupid`)
  5. );
  6.  
  7. CREATE TABLE `chatmessages`(
  8.   `messageid` bigint(20) unsigned not null auto_increment,
  9.   `groupid` bigint(20) unsigned not null,
  10.   /* extra chat message details */
  11.   PRIMARY KEY(`messageid`)
  12. );
  13.  
Jan 15 '09 #2
TheServant
1,168 Expert 1GB
That's what I was thinking. Seeing as you picked the one I was leaning towards I will start there and see if I have any problems. Thanks for your help.

Regards,
The Servant
Jan 15 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: the wonderer | last post by:
This is an elementary question, but I've not been able to find the answer, so here goes: I am developing a site using php. I have the html header information in a file that I include in all the...
60
by: English Teacher | last post by:
Which would be more useful to learn, PHP or COLDFUSION? I know Coldfusion is popular in the work force. Is PHP? Thanks!
43
by: grz02 | last post by:
Hi, Im an experienced database+software designer and developer, but, unfortunately, anything to do with web-programming and web-systems designs is still a pretty new area to me... (been working...
2
by: gruddo | last post by:
Hi this is my first post. I have two webservers. I can run php code fine on one but not the other. Both webservers can read files only one can write. I have looked around at other posts and they...
0
by: 356523600 | last post by:
HTML To PHP Converter 4.2.1.8 Free download Get more for less ... HTML To PHP Converter 4.2.1.8 Get more for less! With a new version of HTML To PHP Converter 4, we've dropped the price and given...
59
by: Lennart Björk | last post by:
Hi All, I have a tiny program: <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MyTitle</title> <meta...
1
by: ansc1 | last post by:
Hello, I'm new to using php coding. I need help with the following: 1. There is a submit button on the form and is saves information to my database. After clicking on "Save Measurement" it...
0
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
0
by: Benjamin Grieshaber | last post by:
Hi, I´m on SuSE 9.3 with xmlrpc-c and xmlrpc-c-devel installed (ver. 0.9.10) I tried to compile php with xmlrpc support and got the following errors: ...
0
by: Patriot89 | last post by:
I have a quick question in reference to php file extenstions... I have code for example like this... This is all located on this site www.ixalliance.com/BHS/Default (This is my nav.php file) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.