1
Good,
I created a crypt that shows all user messages limited to 3. My object is that messages show like this each time they are recent.
MSG hora: 12:30 - OLA
MSG hora: 12:31 - OLA
MSG hora: 12:32 - OLA
The problem is that when there is a new message and there are already 3, it just does not update, shows the 3 old ones, only past +2 messages is that it shows but in ASC form (top to bottom) example:
MSG hora: 12:32 - OLA
MSG hora: 12:31 - OLA
MSG hora: 12:30 - OLA
And you should always show the latest on the 3rd here:
MSG hora: 12:30 - OLA
MSG hora: 12:31 - OLA
Mais recente ->>> MSG hora: 12:32 - OLA
$message_from = "SELECT msg_content, msg_from, msg_date FROM public_messeger_reply WHERE msg_to = '". $_SESSION['u_id'] ."' AND msg_reply_id = '". $order_detail['ads_id'] ."' ORDER BY msg_date DESC LIMIT 3";
$to_query = $con->query($message_from);
if($to_query->num_rows > 0) {
echo "<blockquote>";
while($fetch_to = $to_query->fetch_assoc()) {
echo "<p><b>Negociante:</b> ". $fetch_to['msg_content'] ." <small>". dateName($fetch_to['msg_date']) ."</small></p>";
}
echo "</blockquote>";
}
Now, but the DESC you are using will show in descending order. It should not change to ASC?
– Sam
But ASC shows from the oldest, I want the latest records...
– user21312321
When only 3 works with ASC, but from 4 no longer works.
– Sam
Exactly...dvd.....
– user21312321
How do I make it work...?
– user21312321
and how is the type of date column?
– user60252
the eDATETIME column
– user21312321
Strange,
ORDER BY msg_date DESC LIMIT 3
here worked well, being thatmsg_date
is a type columnDATETIME
– user60252
@Exact leocaracciolo!
– Sam
the last returned here on my site visit table was 2018-05-27 22:03:09
– user60252
now 2018-05-27 22:14:49
– user60252
Are you sure
msg_date
is the column whose type is DATETIME?– user60252
Yes I do. in DESC it shows right... I hit from TOP to BOTTOM, I wanted UP that is ASC, but it does not show the recent... :(
– user21312321
got it, you want to reverse the order in the presentation
– user60252