根据下面的代码status='notlove'
显示用户已经喜欢了,status='love'
表明用户喜欢了它,与这篇文章不同,
问题是,代码为我提供了正确的结果,但是当我喜欢新帖子时,
它没有向我显示适当的结果,而不是向我显示最喜欢的帖子,而是向我显示新帖子的结果,我该如何解决此问题?
也请参考我的表格视图
我得到登录的用户
$id = $_SESSION["id"];
//query for getting the top most timeline id of current log in user
$sql= "SELECT *
FROM lovetimeline
INNER JOIN (
SELECT userId, MAX(timelineId) AS Maxscore
FROM lovetimeline
GROUP BY userId
) topscore
ON lovetimeline.ownerId = '$id'
AND status='notlove'
AND lovetimeline.timelineId = topscore.maxscore";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
//getting the top liked post from table
$_SESSION["toppost"] = $row["timelineId"];
}