我想使用For循环显示表中的所有记录

时间:2012-08-13 11:49:17

标签: php magento magento-1.4 magento-1.6

在此代码中,我必须显示表中的所有记录(cust_college)。但是这个函数只返回那个表的第1行而不是其他行。请告诉我解决方案

$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$a = "SELECT * from cust_college";

$qry = $read->query($a);
$res = $qry->fetch(PDO::FETCH_ASSOC); //fetch row
foreach ($res as $payment) {
    echo $payment = $res[college];
    echo $payment = $res[value_id];
    echo $payment = $res[shop_id];
    echo $payment = $res[cust_address];
}

$store = Mage::app()->getStore()->getCode();

1 个答案:

答案 0 :(得分:0)

$result = $read->getSelect()->getAdapter()->fetchAll('SELECT * from cust_college');