nielsv nielsv - 1 year ago 275
PHP Question

TRUNCATE Table + Zend Framework

I do this:

$data = array('coords' => $district->getCoords(),
'id' => $district->getId(),
'fid' => $district->getFid(),
'wijziging'=> $district->getWijziging(),
'nieuwnr' => $district->getNieuwnr(),
'naam' => $district->getNaam(),
'wijk' => $district->getWijk(),
'wijknr' => $district->getWijknr(),
'objectid' => $district->getObjectid(),
'area' => $district->getArea(),
'len' => $district->getLen(),


_dbTable -> references to my table 'Districts'.

Now I want to clear the table first before I insert the data.

How can I do this?

Answer Source

Try to get the adapter if you really need to truncate the table

$this->_dbTable->getAdapter()->query('TRUNCATE TABLE '.$this->_dbTable->info(Zend_Db_Table::NAME));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download