简体   繁体   中英

Zend_Db_Table_Abstract Insertion fail

I am inserting data in to the database using Zend class Zend_Db_Table_Abstract.

However in some cases when I put long text in to text fields the query execution failed. So I changed my code according to an answer in this site. Finally my code looks.

$objSQL =  $this->objDB->getAdapter()->getConnection()->query($sql);
$result = $objSQL->execute();

This fixed the issue. However with this modification I can't update data in the database. IF I change my code to previous way as bellow, then it starts to update.

$objSQL = $this->objDB->getAdapter()->prepare($sql);
$result = $objSQL->execute();

Can someone help me to fix this issue? Thank you.

I could fix the issue by changing the code. I decided to remove custom insert sql statements. And I passed those to the Send_DB_Table as array. It worked.

$this->objDB->getAdapter()->insert($tableName, $arrayData);

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM