The best way of doing...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

The best way of doing...

Post by oscardog »

Well i'm wondering the best way to do something, this 'something' is a diary to test my PHP and stuff and im wondering whats the best way of storing diary entries?

I think the best way would be to have a MySQL database named 'Diary Entries' and then have tables named after each user? But what is the maximum size of one database/table as i dont want to have to spent alot of money on hosting, if i chose to release it..

So say i got 1000 members... how many databases would i need total to hold those? Because i dont want to have to fork out tons of money for databases if it becomes popular..

So yeh any suggestions, like the best way to do it?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: The best way of doing...

Post by Mark Baker »

The better way would be to have a single table called diary_entries for all users, with a column for user_id in addition to date, event, etc
That way all users access the same single table, but the select statement to retrieve data for any individual user should include WHERE user_id = <user>
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: The best way of doing...

Post by oscardog »

So whats the maximum size of one database, if i was to use your method?

Because once it reaches its maximum, there would need to be another database/table created... So yeh, anyone know the maximum size of one database or table?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Re: The best way of doing...

Post by miro_igov »

Depends of the server storage size or your quota. Also if you use auto increment primary key INTEGER type has it's limits. 'Unsinged' attribute helps to increase the INT range.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: The best way of doing...

Post by oscardog »

So whats the maximum value of int, when using auto increment?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: The best way of doing...

Post by Eran »

Unsigned it has a maximum size of 4,294,967,295. You can use Bigint if you're worried, it goes all the way to 18,446,744,073,709,551,615 :P

From MySQL numeric types - http://dev.mysql.com/doc/refman/5.0/en/ ... types.html
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: The best way of doing...

Post by oscardog »

Haha thanks int sounds big enough to me though ;)

Thanks for all your help, if anyone has any other suggestions.. Feel free to post them! :)
Post Reply