Multiple MySQL Connections On 1 Page

EpicGlobalWeb

New member
Joined
Jan 24, 2016
Messages
467
Points
0
Question:

Is it a poor design to access, with one user, multiple databases to output content from a database on one page?

Plan is to:

1. Call a user

2. Connect to database

3. Echo out the content

4. Close the connection

5. Connect to another database with same user

6. Output content again

And repeat this process with about 10 different databases.
 

steitieh

New member
Joined
Apr 23, 2014
Messages
61
Points
0
Question:

Is it a poor design to access, with one user, multiple databases to output content from a database on one page?

Plan is to:

1. Call a user

2. Connect to database

3. Echo out the content

4. Close the connection

5. Connect to another database with same user

6. Output content again
Do you have codes for each step in this plan? it is normal PHP/Mysql queries or do you use a framework to do them?

And repeat this process with about 10 different databases.
Why you need 10 different databases for this page? for what purposes?
 

EpicGlobalWeb

New member
Joined
Jan 24, 2016
Messages
467
Points
0
That's a good question. I might just need different tables, do you agree?



Also because I already built the DB based this way and it takes too long to fix it now =p

Sorry but it's true.
 

steitieh

New member
Joined
Apr 23, 2014
Messages
61
Points
0
That's a good question. I might just need different tables, do you agree?
If i don't know what purposes and why you want 10 differetn database in this case then I am not sure which idea is better, 10 tables or 10 databases.

Also because I already built the DB based this way and it takes too long to fix it now =p

Sorry but it's true.
What way have you build your DB? any sample queries?
 

EpicGlobalWeb

New member
Joined
Jan 24, 2016
Messages
467
Points
0
Actually I haven't scripted any queries yet. Basically, this is a screenshot of my database:

Capture.JPG

And then on my index.php there are sections like this:

<aside>
<footer>

ect.

Aside will call from one database, footer will call from another. The goal is to centralize all of the content from one place, an admin panel.

In application, this section of the website would call from a database called "spotlight_section" which has 7 table elements (+1 for ID). And it would display the content from the DB like so:

Capture.JPG
 

webdesign

New member
Joined
Jul 5, 2012
Messages
229
Points
0
Actually I haven't scripted any queries yet. Basically, this is a screenshot of my database:

View attachment 1810

And then on my index.php there are sections like this:

<aside>
<footer>

ect.

Aside will call from one database, footer will call from another. The goal is to centralize all of the content from one place, an admin panel.
Question:

Is it a poor design to access, with one user, multiple databases to output content from a database on one page?

Plan is to:

1. Call a user

2. Connect to database

3. Echo out the content

4. Close the connection

5. Connect to another database with same user

6. Output content again

And repeat this process with about 10 different databases.
Interesting discussions, I would suggest you just using a database and using how many tables you wanted, it depends on you. Don't open new database connections if they have same data type and it's just for output content on a page. If you open/close multi connections with many databases, it will make your site load slowly sometimes overload.

From the image mentioned above, you can call data in table by queries and echo where you want them display.
 

EpicGlobalWeb

New member
Joined
Jan 24, 2016
Messages
467
Points
0
Thanks web design, that answered it perfectly.
 

Eugeneus

Member
Joined
Jan 3, 2015
Messages
41
Points
8
Its kinda non standard way its true would be much better to join all database in one single database, I mean just make the single set of tables with the different prefixes, so it wont cause any table names conflicts. But if it isn't a solution for you you can do it your way. Just try to find out the processing time and mysql server loading.
 

LowPingVPS

New member
Joined
Aug 15, 2018
Messages
1
Points
0
Rather than closing the connection, I would recommend (If the same mysql user has access on all of those db) mysqli_seclect_db() assuming your using php.

It's just a single statement issued, and saves the connecting and disconnecting jitter
 
Older threads
Replies
6
Views
2,922
Replies
5
Views
5,625
Latest threads
Recommended threads
Replies
13
Views
6,647
Replies
3
Views
2,563
Replies
3
Views
1,590
Replies
8
Views
3,927

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top