I have already read a few articles, but I can not fix this error that I have. It is the first time I see this error, and I do not know how to solve it. Then using PHP and MYSQL to extract data from the database (use redundancy) and display them in the form of a notification. I'm creating a user notification system, but I had not noticed. The notification system (which is not more than a file notifications.php to extract the data and display them) works correctly on the home page, but not on the profiles or any other page. See.
In this part, notifications work correctly
But in this part, which is the profile of the user, it does not work
This is the PHP code I'm using.
<?php
$notification = $conn->prepare("SELECT n.id_notification,
n.notification_user,
n.notification_send_user,
n.notification_title,
n.notification_datetime,
u.user_image,
u.username
FROM notifications n
INNER JOIN users u
ON u.ID = n.notification_send_user
WHERE n.notification_user = ?");
if ($notification) {
$notification->bind_param("i", $_SESSION["usuario_id"]);
$notification->execute();
$notification->store_result();
$notification->bind_result($id_notification,
$notification_user,
$notification_send_user,
$notification_title,
$notification_datetime,
$user_image,
$username);
while($notification->fetch()){
$title = explode(';', $notification_title);
echo '<li>
<a href="'.$title[0].'" title="'.$title[1].'" class="list-lyrians__item">
<img src="'.$user_image.'" alt="">
<p>
'.$title[1].'
<span>'.$title[2].'</span>
<span class="timeago" title="'.$notification_datetime.'" style="padding-top: 2px;"></span>
</p>
</a>
</li>';
}
$notification->close();
} else{
echo "Ocurrió un error al mostrar las notificaciones" . $conn->error;
}
If you can help me fix this error, I would appreciate it very much.