I am trying to get results from database . For now i tried to take out title from a custom table i made . All is working well except that there are only two rows with one title in each in that table but when the result outputs through echo each of them are repeated four times . My code is
<div class="block-content-col">
<ul>
<?php
$collection = Mage::getModel('example/example')->getCollection();
$keys = array_keys($collection->getFirstItem()->getData());
foreach ($keys as $key){ // loop through all the keys (fname, lname, email...
foreach ($collection as $obj){//loop throught each object
?>
<li class="col-item">
<div>
<span> <?php echo $obj->getData("title");//get the value for a speficic key. ?></span>
</div>
</li>
<?php
}
}
?>
</ul>
</div>