Skip to content
Advertisement

How do I assign different variables for an SQL result that is joined

I am working on a project and I came across something that I just don’t know how to solve. I have 3 tables in a Firebird database :

JavaScript

Team 1 – jumping

JavaScript

The player 10 and 15 are in Team 1

And the last table is this one :

JavaScript

Player 10 -> Alex -> age 25 -> height 175

Player 15 -> Andrew -> age 17 -> height 187

My main goal is to make an HTML page with a textbox, in the textbox I will type the Team number (in this case I will type 1) and it will show me who is in the team with his qualities (age and height).

JavaScript

( keep in mind, $teamNumber is the value introduced by the user in the HTML textbox )

JavaScript

This program outputs 1015 which is fine, means the program is working, but I need to know if there is other way of selecting the players of the team, since this one basically joins their IDs together, and I need them separately so I can assign their IDs to separate variables.

Advertisement

Answer

I believe you need to iterate the array you get from SQL database. Ex.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement