My problem: When the second while loop runs I get an Undefined Index: first and last. I get the right number of first and last Notice messages in each loop. So everything is good except it wont give me the actual names.
I am new to this so I am sure I am just not clear on some rules or something.
$sql = "SELECT * FROM practice WHERE tid='$tid' ORDER BY date";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "<br> ". $row["date"]. " @ " . $row["time"] ." ". $row["pid"] ."
<form action='includes/joinpractice.inc.php' method='POST'>
<input type='hidden' name='pid' value='". $row["pid"] ."'>
<input type='hidden' name='uid' value='". $id ."'>
<button type='submit'>Join Practice</button>
</form> <br>";
$sql = "SELECT user.first, user.last
FROM user
INNER JOIN practice_part ON user.id=practice_part.uid
WHERE pid = '". $row["pid"] ."'";
$innerresult = mysqli_query($conn, $sql);
while ($innerrow = mysqli_fetch_assoc($innerresult)) {
echo "<br> ". $row["first"] ." ". $row["last"] ."";
}
}
I have tried using . $row["user.first"] ." ". $row["user.last"] . but this made no difference. Thank you for any input.