CodeIgniter Forums

Full Version: Help with database design?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[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.

El Forum

[eluser]jackbenning[/eluser]
Here's a good article that may address your design concerns:
http://highscalability.com/how-i-learned...pace-scale

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

El Forum

[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...pace-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.