Help - Search - Members - Calendar
Full Version: [resolved] Archive Help
Codegrrl.com Forums > Script Help > Tutorial Help
Phenix
Everything with my archives has been working well, except for the fact that my month lists appear in ABC order opposed to the that they should be, Jan Feb Mar . . ect I checked the board and saw a few people had the same problem but I didn't see a fix. Would anyone be able to help me?


I tried replacing
CODE
$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%M' ) AS get_month, COUNT(*) AS entries FROM php_blog GROUP BY get_month")
with this
CODE
$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%M' ) AS get_month, COUNT(*) AS entries FROM php_blog GROUP BY get_month ORDER BY get_month ASC");
but it stayed the same.

list code
CODE
<?php include("/mnt/w0603/d08/s07/b025e6a3/www/vintage/cookiecheck.php");
include($headervar.$skin.$extension);?>

<div class="div" id="content">

<p class="h4"> . Archives Page</p><br>

<p class="content">Here is where you can find any archived information especially past blogs.  </p>
<br>



<?php
mysql_connect ('****', '****', '****');
mysql_select_db ('****');

$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%M' ) AS get_month, COUNT(*) AS

entries FROM blog GROUP BY get_month" );

while ($row = mysql_fetch_array($result)) {
    $get_month = $row['get_month'];
    $entries = $row['entries'];

    echo "<a href=\"http://www.walkinginchrist.org/vintage/archive.php?month=" . $get_month . "\">" .

$get_month . "</a> (" . $entries . ")<br />";
}

?>

</div>



archives code
CODE
<?php include("/mnt/w0603/d08/s07/b025e6a3/www/vintage/cookiecheck.php");
include($headervar.$skin.$extension);?>
<div class="div" id="content">
<?php
mysql_connect ('****', '****', '****');
mysql_select_db ('****');

if (!isset($_GET['month'])) {
    die("Invalid month specified.");
}
else {
    $year = (int)$_GET['month'];
}

$result = mysql_query("SELECT timestamp, id, title FROM blog WHERE FROM_UNIXTIME( timestamp, '%M' ) = '$month' ORDER BY id ASC");

while ($row = mysql_fetch_array($result)) {
    $date = date("m/j/Y", $row['timestamp']);
    $id = $row['id'];
    $title = $row['title'];
    ?>
    

    <p> <b>Written On</b> :: <?php echo $date; ?><br />
          »<a href="entry.php?id=<?php echo $id; ?>"><?php echo $title; ?></a>
    </p>
    

    
    <?php
}

?>
</div>
Amelie
I don't think anyone has found a fix for this yet - I was trying to figure it out for another member but I wasn't getting anywhere with it :\
Phenix
lol, Okay Thanks. I guess I'll just roll with it until i cna figure out something. biggrin.gif
Amelie
A bit late (only a year, lol) but I found out how to fix this - see this post.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.