Select Query:- It is used to get the records from the custom table.
Syntax:-
$read_connection = Mage::getSingleton('core/resource')->getConnection('core_read'); $query_data="select * from tablename"; $rowsArray = $read_connection->fetchAll($query_data); // return all rows $rowArray = $read_connection->fetchRow($query_data); //return row
Example:- Suppose, you have to get all records from the employee table.
$read_connection = Mage::getSingleton('core/resource')->getConnection('core_read'); $query_data="select * from employee"; $rowsArray = $read_connection->fetchAll($query_data); // return all rows