I have two tables, in relationship (as you can see in the screenshot):
Now I select from table zerts and want to get all zerts in a list. And now I want to get the username, by the userid. How to access this data which is connected?
$sql = "SELECT * FROM zerts ORDER BY created";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
echo "<tr><td>" . $row["id"] . "</td><td>" . $row["userid"] . "</td><td>" . $row["username"] . "</td></tr>";
}
Why is this not possible to get the username by the userid? I get a blank output at the username field.