I always used Application_Model_DbTable to work with database, but I used MySql. I configured my application.ini like this:
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = admin
resources.db.params.password = 12345
resources.db.params.dbname = daedu
resources.db.params.charset = utf8
and used standart functions of dbtable such as fetchAll or insert. How to have same result, but with PostgreSQL?
I've installed PostgreSQL and through pgAdmin III I already made database and tables. The problem is how to connect it to Zend using db-table?
I configured it like this:
resources.db.adapter = PDO_PGSQL
resources.db.params.host = localhost
resources.db.params.port = 5432
resources.db.params.username = postgres
resources.db.params.password = 12345
resources.db.params.dbname = postgres
resources.db.params.charset = utf8
I work with it through dbtable like this:
class Application_Model_DbTable_Postrgres extends Zend_Db_Table_Abstract
{
protected $_name = 'postgres';
public function insert(){
$data = array(
'name' => "dan"
);
$this->insert($data);
}
}
in Controller:
$f = new Application_Model_DbTable_Postrgres();
$f->insert();
but page doesnot open (error is: net::ERR_EMPTY_RESPONSE) and there is no new insert in table,
when I try to fetchAll in db table, I get application error.