Reputation: 8228
I have following query in my project,
$values = array("test"=>"value")
$this->_db->update("tablename",$values,array('id = ?'=> $data['id'],'wid = ?'=> $data['WId']));
If i execute first time i got updated with values, if i did second time, Sql error will be something like "0 rows affected
" . So here I need to know that exception in zend framwork. Kindly help me
Upvotes: 0
Views: 636
Reputation: 12142
Zend_Db_Adapter_Abstract.update(mixed $table, array $bind, mixed $where)
Updates table rows with specified data based on a WHERE clause.
Parameters:
mixed $table The table to update.
array $bind Column-value pairs.
mixed $where UPDATE WHERE clause(s).
Returns:
int The number of affected rows.
Throws:
Zend_Db_Adapter_Exception
Upvotes: 0
Reputation: 2091
Going from the comments, I think you need to use:
$rowsAffected = $this->_db->update("tablename",$values,array('id = ?'=> $data['id'],'wid = ?'=> $data['WId']));
$rowsAffected
will give you the number of rows affected. So if its 0
, output your message.
Upvotes: 1