Posted by ocditimban on October 2, 2011 at 2:05am
<?php
function insertTable_schema(){
$schema['example']=array(
'fields' => array(
'nid' => array('type' =>'int','not null' => TRUE,'unsigned' => TRUE,'default' =>0),
),
'primary key' => array('nid'),
);
return $schema;
}
function insertTable_install(){
db_insert('example')
->fields(array(
'nid' =>1,
))
->execute();
}
function insertTable_uninstall() {
variable_del('example_default_status');
variable_del('example_threshold_limit');
variable_del('example_threshold_window');
}
this is my code but it's don't create datatable 'example' for me. Why???
Comments
This will work for you
It works for me with the same code which you are using.
Try this..
function test_schema(){
$schema['example']=array(
'fields' => array(
'nid' => array('type' =>'int','not null' => TRUE,'unsigned' => TRUE,'default' =>0),
),
'primary key' => array('nid'),
);
return $schema;
}
function test_install(){
db_insert('example')->fields(array('nid' =>1,))->execute();
}
function test_uninstall() {
variable_del('example_default_status');
variable_del('example_threshold_limit');
variable_del('example_threshold_window');
}
Regards,
Veera Prasad Dagudu
www.drup-all.com