Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 6 of 6
  1. #1
    Platinum Lifetime Member

    Join Date
    Dec 2002
    Location
    Canada
    Posts
    89
    DNF$
    645
    Bank
    0
    Total DNF$
    645
    Donate  

    php - change order of entries

    Hello

    I have a piece of php to list the titles and descriptions of articles. When it prints the info out on the page, it puts the newest article at the bottom of the list and keeps on adding to the bottom.

    Can someone please let me know if I could put a line in the php so the order is the opposite - the newest entries go to the first position and not the last.

    thx so much for you time

  2. #2
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,243
    Bank
    0
    Total DNF$
    6,243
    Donate  

    Re: php - change order of entries

    without the actual code, it would be hard...if the articles are taken from a DB, use "order by" in the SQL command

  3. #3
    mvl's Avatar
    Join Date
    Sep 2006
    Location
    Netherlands
    Posts
    1,179
    DNF$
    7,336
    Bank
    0
    Total DNF$
    7,336
    Donate  

    Re: php - change order of entries

    If you can't solve this with SQL the php function array_reverse() might help you.

  4. #4
    DNF Regular
    cloudfuyun's Avatar
    Join Date
    Aug 2006
    Location
    Suzhou, China
    Posts
    562
    DNF$
    314
    Bank
    19,953
    Total DNF$
    20,267
    Donate  

    Re: php - change order of entries

    ...
    Web Hosting @ $4.95 a year, this offer will be active until July 31, 2009 11:59pm.

  5. #5
    Platinum Lifetime Member
    ibuddy's Avatar
    Join Date
    Jan 2006
    Posts
    35
    DNF$
    252
    Bank
    0
    Total DNF$
    252
    Donate  

    Re: php - change order of entries

    your sql statement should be

    "ORDER BY `column` DESC"

    or

    "ORDER BY `column` ASC"

    Change column to the column in your mysql like id, title etc

  6. #6
    Platinum Lifetime Member

    Join Date
    Dec 2002
    Location
    Canada
    Posts
    89
    DNF$
    645
    Bank
    0
    Total DNF$
    645
    Donate  

    Re: php - change order of entries

    I really appreciate the responses guys. I am sorry I wasn't more specific. I should have really said up front that it is not an sql database.

    I'll post the code which I should have done in the beginning :(
    The articles just go into an article folder.

    Here's the full code:

    <?php

    $folder = "/server path/domainnamehere.com/articles";

    $dirhandle = opendir("$folder");
    while($file_name = readdir($dirhandle)) {
    if ($file_name != "."
    && $file_name != ".."
    && $file_name != "list.php"
    && $file_name != "index.html"
    ) {

    // DO THIS FOR EACH FILE

    // get contents of a file into a string

    $filename = "$folder/$file_name";

    $handle = fopen($filename, "rb");
    $contents = fread($handle, 1000);
    fclose($handle);

    $matches = "";

    // EXTRACT Title
    if(preg_match("'<title>(.+)</title>'i", $contents, $matches)){
    $title = $matches[1];
    print("<div class=\"medium-header\"><A HREF=\"$file_name\">$title</A></div>");
    $matches = "";
    }



    // EXTRACT Description
    if(preg_match("'<META NAME=\"Description\" CONTENT=\"(.+)\">'i", $contents, $matches)){
    $description = $matches[1];
    print("$description<BR><BR><HR>");
    $matches = "";
    }


    print("");

    }
    }

    ?>
    Thx again for helping.

Similar Threads

  1. 3 letter .net for $200
    By mohno in forum DNF$ Sales/Domain Auctions
    Replies: 40
    Last Post: 06-03-2005, 09:43 AM
  2. Can I change a proboards forum into php or vbulletin?
    By dvestors in forum Help Wanted!
    Replies: 5
    Last Post: 04-18-2005, 11:09 PM
  3. Beware of PHP! (& other ones :P )
    By PolurNET.com in forum Humor
    Replies: 13
    Last Post: 11-13-2004, 07:07 PM
  4. Snap account with 22 snaps $25/snap
    By Fearless in forum Advertising and Related Offers
    Replies: 0
    Last Post: 10-22-2003, 07:46 AM
  5. a nice one: mysqlphp.com
    By in forum Domain Name Appraisal Discussion
    Replies: 2
    Last Post: 04-27-2002, 04:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Domain name forum recommended by Domaining.com