im new today for mysql, so please come with me.
I am trying to get 5 bits of data, of which 5 of tbl_playerstats
these columns
StatsID
Score
Kills
Deaths
Rank
Connected with it, that StatsIDis related to another table tbl_playerdata
in this table PlayerIDcoincide with StatsIDtheir values are numeric, and in this tbl_playerdatathere is SoldierNamewhat I'm trying to put in place StatsID, the ultimate goal is that only these shows:
SoldierName
Score
Kills
Deaths
Rank
My code still looks like this (minus the details of connecting to the database
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT StatsID, Score, Kills, Deaths, Rounds FROM tbl_playerstats Limit 10";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<br> Soldier: ". $row["StatsID"]. "<p> Score: ". $row["Score"]. "<p> Kills: ". $row["Kills"]. " <p>Deaths: " . $row["Deaths"] . $row["Rounds"] . "<br>";
}
} else {
echo "0 results";
}
$conn->close();
I have googled, and it seems that use JOINis the way to go, the examples I found did not work for me, it may not be entirely clear what this is called. I'm trying to do.