CodeIgniter Forums
Help with database design? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Help with database design? (/thread-15731.html)



Help with database design? - El Forum - 02-12-2009

[eluser]K-Fella[/eluser]
Hi folks,

I'm planning on building a site somewhat similar to a web hosting directory (using CI) and was hoping to get some input/advice on the database design (mysql) from all you coding gurus ;-P

I'd like to have two different types of users: 1) hosts 2) normal users

Because of the this, I'll need two seperate registration forms (with different fields). Will I require two tables in the db or can I combine them into one? I would also like to allow the host admin to be able to add/edit/delete users associated to that host.

What would be the best way to go about creating the database?

Thanks in advance Smile


Help with database design? - El Forum - 02-13-2009

[eluser]brianw1975[/eluser]
I would have multiple tables, but not the way you are probably thinking.

I would have:
host_accounts table with id, username, host_name, url, etc,etc
user_accounts table with id, username, password, accounts_type_id
account_types table with id, description, access_level
host_accounts table with id, host_accounts_id, user_accounts_id

you could take this a step or two further (give me some slack, it's a bit late) with

user_account_types table with id, user_accounts_id, accounts_type_id

doing that would require removing account_type_id from the above user_accounts table

anyways, hope that helps and if you need more info I'll be happy to assist; you'll probably get a few more suggestions on how to do it.


Help with database design? - El Forum - 02-13-2009

[eluser]jackbenning[/eluser]
Here's a good article that may address your design concerns:
http://highscalability.com/how-i-learned-stop-worrying-and-love-using-lot-disk-space-scale

Good luck with your app! Post a link to it when your done, we'd love to see.


Help with database design? - El Forum - 02-13-2009

[eluser]K-Fella[/eluser]
[quote author="jackbenning" date="1234550612"]Here's a good article that may address your design concerns:
http://highscalability.com/how-i-learned-stop-worrying-and-love-using-lot-disk-space-scale

Good luck with your app! Post a link to it when your done, we'd love to see.[/quote]

To be honest, that article made little sense to me.