How to update a table in SocialEngine

198 Views Asked by At

I know a table in SocialEngine is accessed as follows:

Engine_Api::_()->getDbTable('table_name','plugin_name');   

For example, to access the users table, we use:

Engine_Api::_()->getDbTable('users', 'user');

The question I have is how we can update the table. What APIs and methods are available in SocialEngine to perform this?

In other words, how do we achieve in SocialEngine what the following SQL query does?

UPDATE `engine4_users` SET `phone_number`='12345678' WHERE `user_id`='15'
1

There are 1 best solutions below

0
Gaurav Sharma On

Please use below query in your function.

$userTable= Engine_Api::_()->getDbtable('users', 'user');

                $userTable->update(array(
                'phone_number' =>'12345678',
                ), array(
                'user_id = ?' => '15',

                ));