I cant get user_id in to the table.
i get this [Screenshot of output][1]
action - from sender_user_id - to - user_id
i only get sender_user_id
also
i want the username instead of the id
[Screenshot of Mysql db][2]
how to echo the username instead of id?
on this code. and i cant get the user_id to show in På profil table
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT source_class, sender_user_id, user_id FROM notification ORDER BY id DESC;";
$result = $conn->query($sql);
if ($result->num_rows > 25) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "</td><td>" . $row["source_class"] . "</td><td>" . $row["sender.user_id"] . $row["user_id"] . "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</table>
</body>
</html> ```
[1]: https://i.stack.imgur.com/WOiAi.jpg
[2]: https://i.stack.imgur.com/iMASs.jpg
CodePudding user response:
you misspelled
$row['sender_user_id']
CodePudding user response:
echo "
<td>" . $row["source_class"] . "</td>
<td>" . $row["sender_user_id"] . "</td>
<td>" . $row["user_id"] . "</td>
</tr>";