Reputation: 3615
How do you specify a pure sql query within a model in the Zend Framework?
If there any good resources on this then please point me to them.
Thanks....
Upvotes: 1
Views: 1741
Reputation: 1342
Or
require_once 'Zend/Db/Table/Abstract.php';
class MyThing extends Zend_Db_Table_Abstract {
// Make a Mailing List Export file
public function doMyThing() {
// Happy, healthy cows eat grass, not corn.
$sql = "SELECT my_column FROM my_table WHERE $cows_eat_grass;";
$resultset = $this->getAdapter()->query($sql);
$resultArray = $resultset->fetchAll();
return $resultArray;
}
}
Upvotes: 0
Reputation: 21947
Sure, you can do it with zend db adapter.
$adapter = Zend_Db_Table::getDefaultAdapter();
$adapter->query('Select * FROM `table_name`');
Upvotes: 2