Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How update a database table record in Zend?

Tags:

I am using select like this and it is fetching record successfully:

$table = new Bugs(); $select = $table->select(); $select->where('bug_status = ?', 'NEW'); $rows = $table->fetchAll($select); 

But Now I want to update same record. For example in simple MySQL.

UPDATE TableName Set id='2' WHERE id='1'; 

How to execute above query in Zend ?

Thanks

like image 997
Awan Avatar asked Nov 04 '10 13:11

Awan


1 Answers

$data = array(    'field1' => 'value1',    'field2' => 'value2' ); $where = $table->getAdapter()->quoteInto('id = ?', $id)  $table = new Table();  $table->update($data, $where); 
like image 60
Alex Pliutau Avatar answered Oct 05 '22 12:10

Alex Pliutau