Jump to content

Date Order *SOLVED*


rcharris

Recommended Posts

Hi all,

Something I;ve never done here before, so any help would be appreciated, if you have time please :)

I've got the following code, and basically, I want to order a manually entered in date (mm/dd/yyyy with the latest date at the top and the furthest away at the bottom
[quote]
                      <?php

// Connect to the database server
$dbcnx = @mysql_connect('n/a', 'n/a', 'n/a');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
    'database server at this time.</p>');
}

// Select teh portfolio database
if (!@mysql_select_db('n/a')) {
exit('<p>Unable to locate the portfolio ' .
    'database at this time.</p>');
}

// Request the text of all the news stories
$result = @mysql_query('SELECT title, id, content,date1, updated, url, picturename FROM news ORDER BY date1 ASC');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}

// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
    echo "{$row['date1']}<br /><a href=\"newsstory.php?story={$row['id']}\" class='noba_10_news_nav'>{$row['title']}</a><br /><img src='images/whiteline_154.gif' width='154' height='9'><br />";
}
?>
      [/quote]

(obv. ive removed the db details :))

Thanks :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.