Magento连接数据库查询想要的数据

<?php  
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$select = $connection->select()
->from('catalog_product_entity', array('*')) // 选择查询所有字段,如果只想查询一个字段,把*改成字段名
->where('entity_id=?',1);               // where id =1
//->group('name');         // group by name
$rowsArray = $connection->fetchAll($select); // 返回所以行
$rowArray =$connection->fetchRow($select);   //返回行
var_dump($rowArray);
echo $rowArray[sku];
?>

你可能感兴趣的:(Magento连接数据库查询想要的数据)