How to connect Database
Thanks for previous replies
H开发者_如何学Cow to connect mysql to zend framework. i created table in mysql. i used
$config = array(host' => 'localhost',username' => 'userName','password' => 'sqlpass',
'dbname' => 'databasename',$db = Zend_Db::factory('PDO_MYSQL', $config);
print_r($db->fetchAll("SELECT * FROM tablename"));
this command to connect with database, but whenever i tried this, nothing is displayed. Is there any tutorials to connect database with zend framework. i am new to this topic. pls guide me.
try this:
$config = array('host' => 'localhost',
'username' => 'userName',
'password' => 'sqlpass',
'dbname' => 'databasename');
$ResourceDb = Zend_Db::factory('PDO_MYSQL',$config);
Zend_Db_Table_Abstract::setDefaultAdapter($ResourceDb);
and now try with fetchAll().
which error do you receive?
精彩评论