Everything works fine EXCEPT that the months in my side bar are alphabetically ordered instead of how they should be (January, February, March, etc...)
Does anyone know how I can fix this?
Code that's for the part in my sidebar:
CODE
<?php
mysql_connect ('localhost', '********', '**********');
mysql_select_db ('************');
$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%M' ) AS get_month, COUNT(*) AS
entries FROM php_blog GROUP BY get_month");
while ($row = mysql_fetch_array($result)) {
$get_month = $row['get_month'];
$entries = $row['entries'];
echo "<a href=\"http://prettybloomers.com/archives.php?month=" . $get_month . "\">" .
$get_month . "</a> (" . $entries . ")<br />";
}
?>
mysql_connect ('localhost', '********', '**********');
mysql_select_db ('************');
$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%M' ) AS get_month, COUNT(*) AS
entries FROM php_blog GROUP BY get_month");
while ($row = mysql_fetch_array($result)) {
$get_month = $row['get_month'];
$entries = $row['entries'];
echo "<a href=\"http://prettybloomers.com/archives.php?month=" . $get_month . "\">" .
$get_month . "</a> (" . $entries . ")<br />";
}
?>
And the code for my archives.php page:
CODE
<?php include("header.php"); ?>
<h1><img src="/bullet.gif"> Blog Archives</h1>
<?php
mysql_connect ('localhost', '***********', '*******');
mysql_select_db ('*****');
if (!isset($_GET['month'])) {
die("Invalid month specified.");
}
else {
$year = (int)$_GET['month'];
}
$result = mysql_query("SELECT timestamp, id, title FROM php_blog WHERE FROM_UNIXTIME( timestamp, '%M' ) = '$month' ORDER BY id DESC");
while ($row = mysql_fetch_array($result)) {
$date = date("j/m/Y", $row['timestamp']);
$id = $row['id'];
$title = $row['title'];
?>
<p><?php echo $date; ?><br /><a href="sep.php?id=<?php echo $id; ?>"><?php echo $title; ?></a></p>
<?php
}
?>
<a href="java script:history.go(-1);" onMouseOver="window.status=' ';return true" OnMouseOut="window.status='';return true" class="img"><img src="/back.gif"></a>
<?php include("footer.php"); ?>
<h1><img src="/bullet.gif"> Blog Archives</h1>
<?php
mysql_connect ('localhost', '***********', '*******');
mysql_select_db ('*****');
if (!isset($_GET['month'])) {
die("Invalid month specified.");
}
else {
$year = (int)$_GET['month'];
}
$result = mysql_query("SELECT timestamp, id, title FROM php_blog WHERE FROM_UNIXTIME( timestamp, '%M' ) = '$month' ORDER BY id DESC");
while ($row = mysql_fetch_array($result)) {
$date = date("j/m/Y", $row['timestamp']);
$id = $row['id'];
$title = $row['title'];
?>
<p><?php echo $date; ?><br /><a href="sep.php?id=<?php echo $id; ?>"><?php echo $title; ?></a></p>
<?php
}
?>
<a href="java script:history.go(-1);" onMouseOver="window.status=' ';return true" OnMouseOut="window.status='';return true" class="img"><img src="/back.gif"></a>
<?php include("footer.php"); ?>
Thanks so much!
P.S, I'm not terribly knowledgable about PHP and MySQL, so explanations for dummies are always very much appreciated