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

Update table in raw sql returning value on success

Hello, I write the code below to update a value on a table using raw sql, but I like to get a value like 1 or true on update success instead of a resultset because there's none. How can I do this?

public static function toggleAccess($UsrCod, $UsAtCod)
{
    $sql = "UPDATE
                user_attachment
            SET
                user_attachment.UsAAccess = IF(user_attachment.UsAAccess = 'public', 'private', 'public')
            WHERE
                user_attachment.UsrCod = " . $UsrCod . " AND
                user_attachment.UsAtCod = " . $UsAtCod . ";";
    // Base model
    $user_attachment = new UserAttachment();

    // Execute the query
    return new Resultset(null, $user_attachment, $user_attachment->getReadConnection()->query($sql));
}

Thanks.



404
$this->getDi()->get("db")->execute($sql); // returning boolean