i have created a table as follow


 * @file
 * Implements hook_schema
function core_sms_schema() {
  $schema['core_sms_details'] = array(

    'description' => 'This table is used to keep track of sms sent/failed on specific date.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      'date' => array(
        'description' => 'Date',
        'not null' => TRUE,
      'sms_sent' => array(
        'description' => 'The SMS sent on particular date.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
      'sms_failed' => array(
        'description' => 'The SMS failed on particular date.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => '0',
    'primary key' => array('id'),
  return $schema;

After a sms has been sent i have to update the columns with number and date. i already have rules also but not able to get how to update the custom table using rules.

1 Answer 1


In rules you have option to add PHP code inside the Action ->PHP-> "Execute custom PHP code " in that have a code to update the custom table.

The following variables are available and may be used by your PHP code:

Variable name Type Description

$site Site Site information

$node Content updated content

$node_unchanged Content unchanged content

you can use for updating the table if its a node

Note : here node represented as a example

  • but the table which i am going to update is not node table. its a custom table.
    Feb 18, 2015 at 11:02
  • yes Shridhar in custom table what content are you going to update ? Feb 18, 2015 at 11:04
  • Thank you for the reply. i am going to store sms counts datewise. for example:Today how much sms sent by me and how many sms failed.
    Feb 18, 2015 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.