Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Zend DB Update not posting?
    primarykey
    data
    text
    <p>Other modules in the application are updating, besides this one.</p> <p>Here, I am using a model mapper in attempts to update a row set, as found in <a href="http://framework.zend.com/manual/en/learning.quickstart.create-model.html" rel="nofollow">http://framework.zend.com/manual/en/learning.quickstart.create-model.html</a></p> <pre><code> public function SomeAction() { $mapper = new Application_Model_SomeMapper(); $model = new Application_Model_SomeModel(); //getters and setters // action body $request = $this-&gt;getRequest(); $data = $this-&gt;_request-&gt;getParams(); $someId = $data['someid']; $get = $mapper-&gt;find($someId, new Application_Model_SomeModel, true); //find the row by id, and return array /* instantiating a form object and adding "submit" */ $form = new Module_Form_FormName(); $form-&gt;setAction("/module/controller/action/params/$someId"); $form-&gt;setMethod('post'); $form-&gt;setName('some_edit'); $submit = $form-&gt;createElement('button', 'submit'); $submit-&gt;setAttrib('ignore',true); $submit-&gt;setLabel('Edit Something'); $form-&gt;addElement($submit); if ($this-&gt;_request-&gt;isPost()) { if($form-&gt;isValid($request-&gt;getPost())) { $data = $this-&gt;_request-&gt;getPost(); if(empty($data['some_id' ])) { $data['tier_models_id'] = NULL; } unset($data['submit']); $setters = $model-&gt;setId($data['id']) -&gt;setField1($data['field_1']); if ($mapper-&gt;save($someId, $setters)) { $this-&gt;_redirect("/index/"); } } } $form-&gt;populate($tier); $this-&gt;view-&gt;form = $get; } </code></pre> <p>Here is an example of the save mapper function, except I've included an additional $id parameter</p> <pre><code>public function save(Application_Model_Guestbook $guestbook) { $data = array( 'email' =&gt; $guestbook-&gt;getEmail(), 'comment' =&gt; $guestbook-&gt;getComment(), 'created' =&gt; date('Y-m-d H:i:s'), ); if (null === ($id = $guestbook-&gt;getId())) { unset($data['id']); $this-&gt;getDbTable()-&gt;insert($data); } else { $this-&gt;getDbTable()-&gt;update($data, array('id = ?' =&gt; $id)); //not happening, although the 'id' is passed as a param } } </code></pre> <p>Is there something missing?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload