Data persistence - UPDATE

68 views
Skip to first unread message

Antonio Pereira

unread,
Oct 20, 2015, 2:31:20 PM10/20/15
to NotORM
Hi,

Is there any limitation on the update process?
I need to update two of the three fields in a table. But with this code I can just update one field

...
   } elseif ($app->request->isPost()) {
        $request = $app->request;
        $id = $request->post('id');
        $value = $request->post('value');
        $desc = $request->post('desc');
        $axis=$db->axis()->where('id',$id)->fetch();
        if ($axis) {
            $axis->update(array('value' => $value, 'desc' => $desc));
...

The table name is axis. Has three fields: 'id' (int), 'value' (varchar) and 'desc' (varchar)
I am using
NotORM with Slim framework.

Any suggestions on this? it is possible to run this type of action?
Thank you

Allysson David

unread,
Oct 20, 2015, 6:28:08 PM10/20/15
to not...@googlegroups.com
This shouldn't happen. The problem must lie somewhere else.
Try dumping the data along the lines and see if you find something.

Antonio Pereira

unread,
Oct 26, 2015, 5:43:08 PM10/26/15
to NotORM
Hi David,
The real problem was the definition of the field name.
'desc' is a reserved word in mysql.
I built the table through a script, so the error was not released immediately.
Now the NotORM runs like a charm.
Thanks for the tip.

Allysson David

unread,
Oct 26, 2015, 10:17:14 PM10/26/15
to not...@googlegroups.com
Nice.
Reply all
Reply to author
Forward
0 new messages