I need to order posts by date. Unfortunately I made the sql table using a varchar(255) type not a timestamp or date type. The date is a string which is the output of date(Y.m.d); Is there any way to sort by date? And is there any way to add time to it as well? am i better off altering the sql table to make the column a "timestamp"? would that be easier to do?
This is what I have currently.
Code:
<table bgcolor="CDCDCD" border="0" width="100%">
<?php
/* connect to the db */
$connection = mysql_connect('localhost','fencing','y2ZG7bsSZhMbMExR');
mysql_select_db('fencing',$connection);
$result = mysql_query("SELECT * FROM homeposts ORDER BY postid DESC");
while($row = mysql_fetch_array($result))
{
echo "<tr><td><h3>" . $row['postdate'] . " | " . $row['postname'] . " - " . "</h3></td></tr><tr><td>" . $row['content'] . "</td></tr><tr><td></td></tr>";
}
?>
</table>
Bookmarks