Finally I was able to solve the code. Here what I did, Old code line:
$query = $conn->prepare("SELECT * FROM ".C_MYSQL_MESSAGES." WHERE (sender_id =? AND receiver_id=?) OR (sender_id =? AND receiver_id=?) ORDER BY `date_added` ASC");
New code line:
$query = "SELECT * FROM ".C_MYSQL_MESSAGES." WHERE (sender_id =? AND receiver_id=?) OR (sender_id =? AND receiver_id=?) ORDER BY `date_added` ASC";
Old code line:
$stmt->bind_param("siis", $_SESSION['m'],(int)$_GET['id'],(int)$_GET['id'],$_SESSION['m']);
New code line:
$stmt->bind_param("siis",$_SESSION['m'],$_GET['id'],$_GET['id'],$_SESSION['m']);
Final Code:
prepare($query);
$stmt->bind_param("siis",$_SESSION['m'],$_GET['id'],$_GET['id'],$_SESSION['m']);
$stmt->execute();
$result = $stmt->get_result();
while($j = mysqli\_fetch\_array($result))
{
$c = mysqli\_query($conn,"UPDATE ".C\_MYSQL\_MESSAGES." SET status=1 WHERE id=".$j\['id'\]);
$class = "";
$date\_class = "";
if($j\['sender\_id'\] == $\_SESSION\['m'\])
{
$class = "right";
$date\_class = "date\_left";
}
else
{
$class = "left";
$date\_class = "date\_right";
}
echo '
'.$j['date_added'].''.$j['message'].'
';
}
}
?>
Thanks for your valuable suggestions to fix this issue