Darius
Darius

Reputation: 1664

How to connect zend framework to database?

I installed LAMP on a fresh server and Zend Framework aswell. I now want to connect to my database using

$db = Zend_Registry::get('db'); // Starts connection
$db -> query($query); // Runs the connection

I had coders set up my site, now that I'm trying to setup everything on my own. I can't find where they're connecting.

Upvotes: 0

Views: 1455

Answers (1)

Yanick Rochon
Yanick Rochon

Reputation: 53616

Take a look at the documentation.

You might want to take a look at your application Bootstrap, or your configuration files as it can be setup in either of them.

The part that's actually binding the configuration and creating your adapter is Zend_Application_Resource_Db (in 1.11 anyway since 1.8)

** EDIT **

One way to understand ZF's inner working is to walk the bootstrap process (starting with your /index.php file (should be in /public or whatever your public folder name is). Locating your configuration files should also be a good starting point as they contain valuable information about your application resources. Those files should be in your application root directory, somewhere.

Upvotes: 3

Related Questions