This is how my table is shown.
The code for the creation and returning of the table: i would like to test the value of the sport ID value. if it is 1, return football. if it is 2 return Tennis and if it is 3 return swimming. And if the away column is TRUE i want it to output Away, else output HOME.
$sql = "CREATE TABLE fixtureDetails
(
fixtureID INT(5) NOT NULL AUTO INCREMENT,
opponent VARCHARD(30) NOT NULL,
date DATE
away BOOLEAN,
sportID INT
refereeID INT,
PRIMARY KEY (fixtureID),
FOREIGN KEY (sportID) REFERENCES sport(sportID),
FOREIGN KEY (refereeID) REFERENCES referee(refereeID)
)";
$sql1 = "SELECT * FROM fixtureDetails";
if ($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result)>0){
echo "<table>";
echo "<tr>";
echo "<th>fixtureID</th>";
echo "<th>opponent</th>";
echo "<th>date</th>";
echo "<th>away</th>";
echo "<th>sportID</th>";
echo "<th>refereeID</th>";
echo"</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['fixtureID'] . "</td>";
echo "<td>" . $row['opponent'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['away'] . "</td>";
echo "<td>" . $row['sportID'] . "</td>";
echo "<td>" . $row['refereeID'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_free_result($result);
} else {
echo "No records matching your query found.";
}
} else {
echo "ERROR: could not execute $sql1. " . mysqli_error($link);
}

Home and AwaySportvia:FOREIGN KEY (sportID) REFERENCES sport(sportID)in his table create script.