Advices needed about organising DB's

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
MindOverBody
Forum Commoner
Posts: 96
Joined: Fri Aug 06, 2010 9:01 pm
Location: Osijek, Croatia

Advices needed about organising DB's

Post by MindOverBody »

Hey guys! I got some job to do. Some web page need to be upgraded to have user registration, profiles and so on. Also i need to program simple ad's pages. There is already webpage's database with articles and stuff, and also there is one database for ad's. Now i need to implement user support for registration, adding ad's, etc. Can someone give me advice about right way to implement user database/table? Where to put it? To make new database for that or just to add new table to existing one? In future there will be added disscusion board which will lay on that "registered users" database.

Thanks in advance,
Bojan
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Advices needed about organising DB's

Post by josh »

switching databases during a page load takes up a lot of milliseconds, only do it if you have a really good reason. Like legal or technical requirements. (Ex. if you need to install two applications that don't prefix the table names, or your client made you agree to keep his data extra secure and made you pinky promise, or your database was too large for your OS).

You'd need two connections, two different mysql users to even get any security benefit too.
User avatar
MindOverBody
Forum Commoner
Posts: 96
Joined: Fri Aug 06, 2010 9:01 pm
Location: Osijek, Croatia

Re: Advices needed about organising DB's

Post by MindOverBody »

Tnx for reply. I am going to incorporate it all in one database.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Advices needed about organising DB's

Post by Weirdan »

josh wrote:switching databases during a page load takes up a lot of milliseconds,
Do you mean

Code: Select all

use AnotherDatabase;
? It's rarely the way people use multiple databases, usually there are just multiple connections, each to its own database.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Advices needed about organising DB's

Post by josh »

I did mention using two connections, as it would be the only way to get the intended security benefits. It still slows your page down if you do it just to do it, right?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Advices needed about organising DB's

Post by Weirdan »

josh wrote:It still slows your page down if you do it just to do it, right?
With persistent connections - not so much. They have their own issues though.
Post Reply