Connect multiple tables with main table(phpmyadmin)

Hey :blush:

I have a main table (tbl_member) that connects to login script but then I have various other tables for chat, forum, etc. How do I connect all the tables so they can function as one unit or do I have to add the tables within my script?

Thank ya!!

Well, that is a loaded question… Let’s see if I can explain…

First, you create a database, usually named for your website.

Next, you create tables that pertain to different types of data to be stored into each of them.
( Such as users table, chat-posts table, etc. )

Then, in the pages on your website, you create PHP code that accesses MySQL or other database libraries to handle the CRUD of the data. CRUD is a term meaning Create/Read/Update/Delete data.
These tables are used only when needed and therefore should be separate tables. You only need to access the user’s table when a new user registers, changes their profile info or logs into your site.
There is no need to access the chat posts table when a user is editing their profile page.

Make sense? Once it awhile, you will need to combine table data into one list and you do that using the JOIN functions in the database language. This lets you combine data as needed into a bigger picture when you need fields from more than one table.

Lastly, you make a connection to the table once per web page. You select data from a table or many tables using your queries. The tables are all at hand in the one database and therefore are all connected once you connect to the database itself.

Hope that helps get you started understanding this.

1 Like

Sorry for the late response…wasn’t feeling well. I gotcha…I assumed every part of the site had to flow through the main table and it doesn’t.

Sponsor our Newsletter | Privacy Policy | Terms of Service