Insert a record in DB

  • strict warning: Declaration of T3Params::set() should be compatible with JObject::set($property, $value = NULL) in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/core/params.php on line 0.
  • strict warning: Non-static method T3Cache::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 4.
  • strict warning: Non-static method T3Profile::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 6.
  • strict warning: Non-static method T3Xml::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 7.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 27.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 28.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 29.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 30.
  • strict warning: Non-static method T3Cache::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 4.
  • strict warning: Non-static method T3Profile::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 6.
  • strict warning: Non-static method T3Xml::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 7.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 27.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 28.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 29.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 30.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 38.
  • strict warning: Non-static method T3Path::addPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 38.
  • strict warning: Non-static method T3Path::getPaths() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/libraries/t3.php on line 48.
  • strict warning: Non-static method T3Profile::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/joomlart.engine on line 226.
  • strict warning: Non-static method T3Path::getTplFile() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/joomlart.engine on line 257.
  • strict warning: Non-static method T3Path::getPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/core/path.php on line 216.
  • strict warning: Non-static method T3Cache::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/core/path.php on line 83.
  • strict warning: Non-static method T3Profile::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/joomlart.engine on line 226.
  • strict warning: Non-static method T3Path::getNodeTpl() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/joomlart.engine on line 255.
  • strict warning: Non-static method T3Path::getPath() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/core/path.php on line 206.
  • strict warning: Non-static method T3Cache::getInstance() should not be called statically in /home/humas.ui.ac.id/public_html/sites/all/themes/engines/joomlart/core/path.php on line 83.

Hi all,

I try to insert a simple record into the Drupal's DB main schema but it does not work.

The code I post here is very simple. When the submit button is pressed, I want the record to be inserted.

function formexample_nameform_submit($form_id, $form_state) {
$table = 'Billet';
$record = new stdClass();
        $record->id = 5
$record->description = t('new_try');
drupal_write_record($table, $record);

drupal_set_message(t('done'));
}

Furthermore, field type mapping has been done during the new module's installation.

function moduleName_Billet_schema() {
$schema['Billet'] = array(
  'description' => t('description'),
  'fields' => array(
    'id' => array(
      'description' => t('id'),
      'type' => 'serial',
      'not null' => TRUE,
    ),
    'timeBillet' => array(
      'description' => t('time'),
      'type' => 'datetime',
      'not null' => FALSE,
    ),
    'description' => array(
      'description' => t('descriptions'),
      'type' => 'varchar',
      'length' => '200',
      'not null' => FALSE,
    ),
  ),
  'primary key' => array('id'),
);

return $schema;
}

The Drupal user has the required privileges.

Can you tell me what could be wrong with that ?

Thanks !