here is my file contents
-
<?xml version="1.0" encoding="utf-8"?>
-
<trans>
-
<transfer>
-
<id>1</id>
-
<acno>B900326</acno>
-
<amount>10000</amount>
-
<type>Credit</type>
-
<memo>(Credit)memo!@#$%^&*()_+|}{":?><</memo>
-
<fee>0</fee>
-
<ft_acno>Admin</ft_acno>
-
<batch>1</batch>
-
<tempbalance>10000</tempbalance>
-
<date>2009-07-11</date>
-
<time>1247288167</time>
-
</transfer>
-
<transfer>
-
<id>2</id>
-
<acno>P587178</acno>
-
<amount>98</amount>
-
<type>Credit</type>
-
<memo>test</memo>
-
<fee>2</fee>
-
<ft_acno>B900326</ft_acno>
-
<batch/>
-
<tempbalance>98</tempbalance>
-
<date>2009-07-11</date>
-
<time>1247288200</time>
-
</transfer>
-
<transfer>
-
<id>3</id>
-
<acno>B900326</acno>
-
<amount>100</amount>
-
<type>Debit</type>
-
<memo>test</memo>
-
<fee>0</fee>
-
<ft_acno>P587178</ft_acno>
-
<batch/>
-
<tempbalance>9900</tempbalance>
-
<date>2009-07-11</date>
-
<time>1247288200</time>
-
</transfer>
-
<transfer>
-
<id>4</id>
-
<acno>P662318</acno>
-
<amount>196</amount>
-
<type>Credit</type>
-
<memo>testing</memo>
-
<fee>4</fee>
-
<ft_acno>B900326</ft_acno>
-
<batch/>
-
<tempbalance>196</tempbalance>
-
<date>2009-07-13</date>
-
<time>1247460597</time>
-
</transfer>
-
<transfer>
-
<id>5</id>
-
<acno>B900326</acno>
-
<amount>200</amount>
-
<type>Debit</type>
-
<memo>testing</memo>
-
<fee>0</fee>
-
<ft_acno>P662318</ft_acno>
-
<batch/>
-
<tempbalance>9700</tempbalance>
-
<date>2009-07-13</date>
-
<time>1247460597</time>
-
</transfer>
-
</trans>
-
there are totally 5entry's in it.
i need to display it in descending order.
I had found an way to display it in the descending order as follows..
-
<?
-
$filename='test.xml';
-
-
$data = simplexml_load_file($filename);
-
-
$c=count($data->transfer);
-
-
for($i = $c; $i>=0 ; $i--){
-
-
echo $i.'-'.$data->transfer[$i]->time.'<br>';
-
-
}
-
?>
-
which results in giving the the output as follows
6-
5-1251866501
4-1251866308
3-1251804653
2-1251802528
1-1251802455
0-1251802411
Did i followed the correct way?
or is there an anyother formatted approach for this one?
And can i make a search and display results in xml file like doing in sql...
if there give me some ideas..