DNforum.com - Domain Sales, Domain Forum, Domain Appraisals
 
Register Now! Welcome to Dnforum.com You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast and simple so please, join our community today! If you have any problems with the registration process or your account login, please contact us.
Go Back   DNForum - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars > Content Development > Website Development and Design Discussion > Coding/Programming/Languages
Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2007, 10:24 AM   #1 (permalink)
Platinum Lifetime Member
 
Last Online: 06-15-2008 09:17 PM
iTrader: (5)
Join Date: Dec 2002
Posts: 89
DNF$: 534
Location: Canada
Country:


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
roseau is offline   Reply With Quote
Old 02-08-2007, 10:46 AM   #2 (permalink)
www.LOL.biz
 
Bender's Avatar
 
Name: Daniel
Last Online: 07-07-2008 10:31 PM
iTrader: (13)
Join Date: Apr 2004
Posts: 1,783
DNF$: 5,162
Location: .ro
Country:


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
Bender is offline   Reply With Quote
Old 02-08-2007, 11:11 AM   #3 (permalink)
mvl
formerly known as 'leo'
 
Last Online: Today 01:21 AM
iTrader: (12)
Join Date: Sep 2006
Posts: 634
DNF$: 100
Location: Netherlands
Country:


Re: php - change order of entries

If you can't solve this with SQL the php function array_reverse() might help you.
__________________
SATAN.EU APPLICATIONS.EU MEDICALSERVICES.EU REFERRAL(s).EU
VOI.EU UUDD.COM
mvl is online now   Reply With Quote
Old 02-08-2007, 12:20 PM   #4 (permalink)
DNF Regular
 
cloudfuyun's Avatar
 
Last Online: 06-27-2008 05:57 AM
iTrader: (37)
Join Date: Aug 2006
Posts: 547
DNF$: 342
Location: Suzhou, China
Country:


Re: php - change order of entries

...
__________________
me
cloudfuyun is offline   Reply With Quote
Old 02-08-2007, 01:40 PM   #5 (permalink)
Platinum Lifetime Member
 
ibuddy's Avatar
 
Last Online: 03-30-2008 01:17 AM
iTrader: (0)
Join Date: Jan 2006
Posts: 34
DNF$: 96


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
ibuddy is offline   Reply With Quote
Old 02-10-2007, 02:54 PM   #6 (permalink)
Platinum Lifetime Member
 
Last Online: 06-15-2008 09:17 PM
iTrader: (5)
Join Date: Dec 2002
Posts: 89
DNF$: 534
Location: Canada
Country:


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:

Quote:
<?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.
roseau is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -4. The time now is 01:25 AM.
Copyright @2001-2008 DNForum.com

Learn Domains
Promote Domains
Research Domains
Buy Domains
Resell Domains
Park Domains
Sell Domains
Build Domains
Host Domains
Trademark Domains
Domain Domains
manage Domains
Appraise Domains