We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Unable to perform the update

$phql = "UPDATE admin SET admin.name = :name: WHERE admin.email = :email:";
        $res = $this->getModelsManager()->executeQuery($phql, array(
            'name' => 'adsadsadsa',
            'email'   => '[email protected]'
        ));
        var_dump($res->success());

Eventually perform: SELECT admin.id, admin.name, admin.email, admin.password, admin.phone, admin.group, admin.status, admin.cid, admin.create_at, admin.update_at, admin.last_login_at FROM admin WHERE admin.email = :email

edited May '15

As the ORM implements ActiveRecord the code you're executing is actually:

$admin = Admin::findFirstByEmail("[email protected]");
$admin->name = 'adsadsadsa';
if (!$admin->update()) {
    foreach ($admin->getMessages() as $message) {
         echo $message;
    }
}

So, you're missing the lastest step:

$phql = "UPDATE admin SET admin.name = :name: WHERE admin.email = :email:";
$res = $this->getModelsManager()->executeQuery($phql, array(
     'name' => 'adsadsadsa',
     'email'     => '[email protected]'
));
if (!$res->success()) {
    foreach ($res->getMessages() as $message) {
         echo $message;
    }
}


1.8k

I don't want to be updated according to the primary key;If table does not have a primary key can only be updated according to the conditions how to solve?

Use the database component:

$this->db->execute("UPDATE admin SET admin.name = :name WHERE admin.email = :email", array(
            'name' => 'adsadsadsa',
            'email'     => '[email protected]'
));