Hello, I have a mysql query
$query = "SELECT * FROM comments WHERE commenter_username IN (" . join(',', $list) . ") Or Number IN (" . join(',', $list) . ") ORDER BY comment_id DESC";
I want the query to select one row, the row with the highest id. Then store that id into a variable and then select a row thats id is lower than the previous id.
so im thinking it would look something like this
$query = "SELECT * FROM comments WHERE commenter_username IN (" . join(',', $list) . ") Or Number IN (" . join(',', $list) . ") ORDER BY comment_id DESC";
$results = mysql_query($query);
while($row = mysql_fetch_array($results)){
$commentID = $row['comment_id'];
}
$query = "SELECT * FROM comments WHERE commenter_username IN (" . join(',', $list) . ") Or Number IN (" . join(',', $list) . ") WHERE comment_id < $commentID LIMIT 1";
This is what I want to happen but I am not sure how this would work. the $list variable is an array that is parsed with a comma so the mysql query can comprehend it.