开发者

How to connect Database

开发者 https://www.devze.com 2023-04-07 06:46 出处:网络
Thanks for previous replies H开发者_如何学Cow to connect mysql to zend framework. i created table in mysql. i used

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号