1.first set the bootstrap
protected function _initAppAutoload()
{
$moduleLoad = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH
));
}
2.set up the database connection in another class file or config.ini
first write code in ini file
[general]
db.adapter = PDO_MYSQL
db.config.host = localhost
db.config.user = root
db.config.password = password
db.config.dbname = zend
then in public index.php write code
$config =new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini','general');
Zend_Registry::set('config',$config);
//database
$db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);
3.create the class in model and give the name of the table
No comments:
Post a Comment