Note that there are some explanatory texts on larger screens.

plurals
  1. PODB select two Tables
    primarykey
    data
    text
    <p>I've searched around and can't seem to understand how to get this to work. At least, not the way my code is written. What im having trouble doing is changing this:</p> <pre><code>// ... $sql3 = new db; $sql3-&gt;db_Select(DB_TABLE_ROSTER_TEAM_MEMBERS, "*", "team_id = ".intval($row1['team_id'])." ORDER BY member_team_order"); while($row3 = $sql3-&gt;db_Fetch()) { // ... </code></pre> <p>...to something that orders by the column <code>status_order</code>, which is located in a different table <code>DB_TABLE_ROSTER_MEMBER_STATUS</code>. So essentially I'm trying to include 2 tables in the same <code>SELECT</code> query, so that I can change the <code>ORDER BY</code>. Can anyone explain how this is done? Any help would be greatly appreciated. Thank you.</p> <p><strong>UPDATE</strong></p> <p>I'm going to try and explain this as much as I can. Hopefully someone will be able to explain to me in a way I can understand.</p> <p>By default, this code is meant to grab the users and place them in their respective "team_id", then order them by a selectable drop down box that allows me to change the order. However, the part that orders the members is not working, so I decided I wanted to have it automatically order by the member status that is located in the other table. The other table holds the team names and team order, along with other data that is not needed right now. I didnt even know if this was possible.</p> <p>There is another code a little further down that may help as well, as it shows the structure of the table. It's what gives the names color as seen on the site I mentioned.</p> <p>Hopefully I've helped explain it a bit more.</p> <p><strong>And some more requested by Johan</strong></p> <p>Here is the structure of the two tables.</p> <p><code>roster_team_members</code> fields:</p> <pre><code>member_id member_name team_id team_name game_id game_name member_team_status text_color member_team_order </code></pre> <p><code>roster_member_status</code> fields:</p> <pre><code>status_id status_name text_color status_order display </code></pre> <p>Iv decided to fix the manual member order. iv found an error while debugging. if i cant figure out how to fix it il pot another question. thank you all for your help. iv just decided to go another route that should prove to be easier.</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