Order a MySQL result by Date and Time in PHP

Posted by DomingoSL on Stack Overflow See other posts from Stack Overflow or by DomingoSL
Published on 2010-04-27T21:47:20Z Indexed on 2010/04/27 21:53 UTC
Read the original article Hit count: 348

Filed under:
|

Hi, i have this code:

$datos = mysql_query("SELECT * FROM `usuarios` LIMIT 0, 30 ");

Who is a simple MySQL query in php, but i need the result organized by date and time. There is a field in my table who has this value (automatic inserted when the user sing up in my page). So the table is something like this:

Id Name       DT
1  Domingo    2010-04-26 23:00:00
2  Cesar      2010-04-25 12:00:00
3  Nataly     2010-04-26 08:00:00

DT is a "datetime" field. How can i get the result order by new to old? Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql