PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if i have a mysql statement and want to use order date by desc what type of format does the date have to be in? right now it is in date() php function format. Do i just use sql field date to do the order by? How should it be setup?
$sql = "(SELECT author,subject,tid FROM threads) UNION ALL (SELECT
author,subject,tid FROM topics) ORDER date BY DESC LIMIT 8";
That is my code..
This is my date..
Tuesday, Aug, 17
Suggestions?
thank you
Anthony
btw this is my error
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'tid BY DESC LIMIT 8' at line 2
Last edited by pinehead18 on Tue Aug 17, 2004 6:00 pm, edited 1 time in total.
it'd be a pain to correctly sort that without converting it back into a usable timestamp.. hmmm.. does the field have to be varchar? Why not use a DATE or INT type?
you can still use the date function, just pass it the timestamp that's stored as an INT.. if you're following my usage..
instead of storing the result of date(), you store time() lets say.. then when you want to print out that timestamp.. you use the date function to get the proper naming..
so, use time() and upload that to the table. In int form. Then pull the time and use the date() function to make that time legable in the same manner that it is currently in?
This will fix the order by date problem of my sql?