foreach($CarAdList as $CarAd)
{
echo($msg .= '<tr><td>'.$CarAd->getCarAdID().'</td><td>' .$CarAd->getBrandText().'</td><td>' .$CarAd->getDescription(). '</td><td><a href="status.php?id='.$CarAd->getCarAdID().'"><img src="../images/active.png" /></a></td><td><img src="../images/delete.png" width="30px" /></td></tr>');
}
e.g, the number of rows =38
n= the number of rows * the number of rows--
it is running n times
so its displaying
5
5
4
5
4
3
5
4
3
2
5
4
3
2
1