Reputation: 17
I want to make it order on message_date
and message_time
.
Now if i use;
$message_show = $db->prepare("SELECT * FROM messages WHERE reciever=? ORDER BY message_date");
$message_show->bindParam(1, $id);
$message_show->execute();
This wil order on the date, but now i want to use a second parameter message_time
to order it depend on the date and time, how to do this ?
UPDAE
Sorry forgot to add, i want the message_time output reverse so the newest time must come first. Example; Message time1: 09:30 and Message time 2: 09:31.
Now it gives 09.30 first i want the 09:31 first because thats the newest input.
Upvotes: 1
Views: 51
Reputation: 4696
You should be able to simply add a second attribute to the SELECT
statement
$message_show = $db->prepare("SELECT * FROM messages WHERE reciever=? ORDER BY message_date ASC, message_time ASC");
I do not believe it to be more complicated than this.
Upvotes: 1