Jump to content

Join 5 tables


snk

Recommended Posts


hello to all,

 

First of all Im sorry for bothering you with so big message. Iam trying to build a mini cms and i have 5 tables, DB design is fine for my opinon, plz correct if you realise something wrong. From past experience I have Joined multiple table via php values, i was quering a table i was puting the key of the linked table to a value and then i was quering again and again and again.

 

I think is time to move on to a better level. So Im explaining you the design and hopefuly somebody can give me the right query, coz I have spent more than a day trying JOINS and UNIONS

 

I have 5 tables: Tips, Text, Page, Category, Links

 

Page and Links belong to a category, thus I have put the category_key in Page and Links

Tips and Text belong to Page, thus I have put the page_key in Tips and Text

 

Now, instead of querying 25.ooo times the database, I would like to get back a table with All of the fields according a value that is coming with GET and represents the page_key.

 

a row flow is coming like

$page = $_GET


;

 

$query_return = SELECT page.title, text.text, links.text, links.page_key, tips.text

 

and of course later I  echo the values of the return query in the right positions, I know how to do it, plz dont bother to explain

Just, to help you to help me, I mention again that Page table is linked with Links table via Category table

 

Thank you in advance

Spiros.

 

 

Link to comment
https://forums.phpfreaks.com/topic/96000-join-5-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.