> Not sure what I am doing wrong.
>
> //This works
> $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713';
> $this->view->result = $this->db->fetchAll($sql);
>
> //This does not
> //$select = $this->db->select()
> $select= $this->db->select()->from( 'runz_miles',
> 'EMPL_NO')->where('empl_no = ?', 31713);
> echo $select->__toString();
> //print_r($this->db->fetchAll($select));
> This gives me table does not exist.
>
> echo $select->__toString(); gives me:
> SELECT "runz_miles"."EMPL_NO" FROM "runz_miles" WHERE (empl_no = 31713)
> EMPL_NO should not be prefixed with runz_miles which is the table name.
>
> Here was my connection init()
> function init(){
>
> $config = new Zend_Config_Ini(APPLICATION_PATH . "/config.ini",
> "runzheimer");
> $this->db = Zend_Db::factory($config->db->adapter,
> $config->db->config->toArray());
> $this->db->getConnection();
> }
>
>
>
Hi,
You have to use the option autoQuoteIdentifier to false.
See
http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.parameters
Mickael.
没有评论:
发表评论