title: how to connect to mysql database in zend framework using connection class
body: <p>I am new to Zend framework.I have tried database connection on each particular page in action method of controller its working fine.<br>
  I am using WAMP server, but now I want to learn database connection class on one page.and using that on different different action method. I want a connection made on index page and using at the all pages of project.</p>
  
  <p>This is my action method in controller:</p>
  
  <pre><code> public function userAction()
      {
  
          $db = Zend_Db_Table::getDefaultAdapter();
              $data = array(
                   'first_name' =&gt; 'xyz',
                   'last_name' =&gt; 'xyz',
                   'user_name' =&gt; 'xyz',
                   'password' =&gt; 'xyz'
                    );
             $rows_affected = $db-&gt;insert('user', $data);
             $last_insert_id = $db-&gt;lastInsertId();
  
      }
  </code></pre>
  
  <p>and application.ini file is below in which i add only database adapter setting in this file</p>
  
  <pre><code>    [production]
      phpSettings.display_startup_errors = 0
      phpSettings.display_errors = 0
      includePaths.library = APPLICATION_PATH "/../library"
      bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
      bootstrap.class = "Bootstrap"
      appnamespace = "Application"
      resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
      resources.frontController.params.displayExceptions = 0
      resources.db.adapter = "PDO_MYSQL"//adapter
      resources.db.params.host ="localhost" //server name here or host
      resources.db.params.username = "root"///username here
      resources.db.params.password = "" //database password
      resources.db.params.dbname = "zend"//database name
      resources.db.isDefaultTableAdapter = true
  
      [staging : production]
  
      [testing : production]
      phpSettings.display_startup_errors = 1
      phpSettings.display_errors = 1
  
      [development : production]
      phpSettings.display_startup_errors = 1
      phpSettings.display_errors = 1
      resources.frontController.params.displayExceptions = 1
  </code></pre>