tommyda Posted November 15, 2009 Share Posted November 15, 2009 I have a list of movie titles in a database each with a time stamp of the release date The query: <?php $getvideos = mysql_query("SELECT * FROM videolistings ORDER BY releasedate DESC")or die(mysql_error());?> But for some reason the videos are not listing in descending order, EG: the videos on this page http://bit.ly/L8h7F are displaying 2 results from 2000 first then more recent ones from 08 and 09 after. Here is the while loop: <?php while ($video = mysql_fetch_array($getvideos)) { echo '<div style="width:280px; float:left; border:1px dotted #666; padding:5px; margin:5px; "><a href="'.$baseurl.'/videos/'.$video['slug'].'" title="'.ucwords($video['name']).'"><img width="80px"; height="110px"; src="'.$video['smlimg'].'" border="0"/></a></div>'; };?> Can anyone please help me EDIT: I have echo'd out the timestamps for each listing. Link to comment https://forums.phpfreaks.com/topic/181634-solved-order-by-timestamp-listing-in-wrong-order/ Share on other sites More sharing options...
tommyda Posted November 15, 2009 Author Share Posted November 15, 2009 Worked it out, Ill explain what i did for any one else having the same problem. Originally the field was a varchar but for ORDER BY to work it needs to be set as INT. Link to comment https://forums.phpfreaks.com/topic/181634-solved-order-by-timestamp-listing-in-wrong-order/#findComment-958044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.