mathew
mathew

Reputation: 1200

Setting up a MySQL database, avoiding multiple database table accesses

I do have a single database and nearly about 11 tables. While my web page is opening, information from these 11 tables will be accessed at the same time. According to my current settings what I did now is for each table database is opening and closing. Say I had given a username and password to open a database for each table and close after retrieving information from that table.

Is this the right way to do it?? I feel because of this, the database is opening and closing 11 times!!!! Am I right?? Is this the right way to do that?

Oh well, I do have some tables whose update date is different from others...

Upvotes: 2

Views: 86

Answers (1)

G__
G__

Reputation: 7111

Since the tables are in the same database, it's not necessary to keep closing and re-opening the database. Use mysql_connect the first time, and then subsequent calls to e.g. mysql_query will reutilize that same connection, if you don't provide a new one.

Upvotes: 1

Related Questions