我正在为我的网站制定时间表,但是当我运行查询以选择所有小于给定标识符的id时,我遇到了一些问题,它仍会在每次查询时返回标识符结果 例如,如果标识符是id = 4,我想选择小于4的所有内容而不是4> 3> 2> 1我希望它是3> 2> 1
这是我的PHP。我知道它不安全或什么不是,但我已经在准备好的声明中写了它,并得到相同的thign所以我需要一些在这里。
if(isSet($_POST['lastmsg']))
{
$feed_id = mysqli_real_escape_string($con, $_POST['lastmsg']);
$get1 = mysqli_query($con, 'SELECT receiver FROM connection where sender="'.$_SESSION['userid'].'"');
$id_feed = array();
while($id_result1 = mysqli_fetch_array($get1)){
$id_feed[] = $id_result1['receiver'];
$ids1 = join(',', $id_feed);
$get_feed1 = mysqli_query ($con, "select * from feed where users in '".$ids1."' or users='".$_SESSION['userid']."' and 'feed_id' < '".$feed_id."' ORDER BY feed_id DESC LIMIT 2");
}
while($res1 = mysqli_fetch_array($get_feed1)){
echo $load = $res1['feed_id'];
}
}