Retrieve XML results in reverse order - PLEASE HELP!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pounder
Forum Newbie
Posts: 1
Joined: Sun Dec 18, 2005 7:46 am

Retrieve XML results in reverse order - PLEASE HELP!!!

Post by Pounder »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Heya please help, i need to retrieve the Posts in reverse order so the one added the most recently to the xml file will show up at the top...

Code: Select all

foreach($posts -> post as $post)
   {
    if($post -> category =="$cid"){
    echo "
  <tr>
    <td width='80%' height='45' bgcolor='#CCFFCC'><a href=?handle=viewpost&pid=" . $post -> id . ">" . $post -> topic . "</a></td>
    <td width='20%' height='45' bgcolor='#66FFCC'>" . $post -> author . "</td>
  </tr>"; 
    }
   }

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Post by ody »

try adding

Code: Select all

$posts->post=array_reverse($posts->post);
before your foreach.
Post Reply