In my databases, I have the date stored in the format "yyyy-mm-dd" or 2005-06-21....Is there a way to make the following script show the date in another format, for example...
06-21-2005
or even June 21, 2005
or am I stuck with the format that mysql stores it in?
Thanks!
maya
<?
$host="xxxxxx";
$user="xxxxxx";
$password="xxxxx";
$dbname="xxxxxx";
$dbtable="xxxxx";
$homepage="enternew.php";
$dbh=mysql_connect ("xxxxxx", "xxxxx", "xxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxxx");
?>
<table width='100%' border='0' cellspacing='0' cellpadding='5'>
<?
$sql = "SELECT id, date, title, subtitle, first, body, source FROM " . $dbtable . " WHERE category='qa' ORDER BY date DESC;";
$result = mysql_query($sql, $dbh) or die( mysql_error() );
$colorc = 0;
$colors = array('eaeaea', 'ffffff');
while($rows = mysql_fetch_array($result))
{
$color = $colors[((int) $colorc++ & 1)];
print "<tr style=\"background-color: $color\">";
print "<td>$rows[date]</td>";
print "<td><a href=\"qa.php?id=" . $rows[id] . "\">" . $rows[title] . "</a></td>";
print "<td>$rows[source]</td>";
print "</tr>";
}
?>
</table>