@ sign in front of variable

Sometimes in your programming you’ll need to use @ sign in front of a variable. For example, @$_REQUEST[“username”]; The @ sign is an error control operator. When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

For example:

$value = @$cache[$key];
// will not issue a notice if the index $key doesn't exist.


hook_update_last_removed()

Return a number which is no longer available as hook_update_N(). If you remove some update functions from your mycustommodule.install file, you should notify Drupal of those missing functions. This way, Drupal can ensure that no update is accidentally skipped.

Parameters

none

Return value

An integer, corresponding to hook_update_N() which has been removed from mycustommodule.install.

Usage sample

function hook_update_last_removed() {
   // We've removed the 6.x-1.x version of mycustommodule
, including database updates.
   // The next update function is
 mycustommodule_update_6200()
   return 6105;

}


hook_schema()

We use hook_schema() to define the current version of the database schema.

During the module installation process in Drupal, you can create DB tables using .sql query or you can use hook_schema() to create tables and fields. A Drupal schema definition is an array structure representing one or more tables and their related keys and indexes. A schema is defined by hook_schema() which must be located in your module’s .install file.

By implementing hook_schema() and specifying the tables your module declares, you can create and drop DB tables on all supported database engines. You don’t have to deal with the different SQL dialects for table creation and alteration of the supported database engines.

Parameters

No parameters for this function

Return value

A schema definition array. For each element of the array, the key is a table name and the value is a table structure definition.

Usage sample:

function page_title_schema() {
    $schema['page_title'] = array(
    'fields' => array(
    'type'       => array('type' => 'varchar', 'length' => 15,  'not null' => TRUE, 'default' => 'node'),
    'id'         => array('type' => 'int', 'unsigned' => TRUE,  'not null' => TRUE, 'default' => 0),
    'page_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')
    ),
    'primary key' => array('type', 'id'),
    );
    return $schema;
}

If you have multiple table, add another $schema array. Below is an example of multiple tables installed during your installation process.

function module_schema(){
$schema= array();
$schema["table1"] = array(...); // table1 schema

$schema["table2"] = array(...);// table 2 schem
etc.
return $schema;
}

to install both tables, you just use hook_install to install schema

function module_install(){
drupal_install_schema('module');
// where module is name of your module
}