Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP MySQL Getting Data Out of Multiple Tables
    primarykey
    data
    text
    <p>I asked a similar question yesterday which may have been poorly worded, either way I didn't understand and this is something I really need to crack :) I've never done it before and would be very useful for so many of my projects.</p> <p>This is for a directory website. I have three tables: <strong>entry</strong>, <strong>location</strong>, and <strong>entry-locations</strong>. <strong>entry</strong> contains information about a building such as name, address, image, etc. <strong>location</strong> is simply a list of possible locations each building could be. The location table is pretty much irrelevant for this example, it just contains information about the location which I could display on other areas of the site.</p> <p><strong>entry-locations</strong> is a table which links the entries to the locations. It only has two fields, <em>entry-id</em> and <em>location</em>... If you're wondering why I need a seperate table for this is because the same building <em>could</em> have multiple locations (don't ask).</p> <p>Basically, what I need to do is display listings from each location it's own page. For example, I need to list every building in France, so the query needs to go through the <strong>entry-locations</strong> table returning every record with the location 'France', then it needs to pull all the data from the <strong>entry</strong> table corresponding to the <em>entry-id</em>'s returned.</p> <p>I'm sure there is a way to do this with one query and would be extremely greatful if I could be shown how, I could replicate this in so many projects.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload