By huangweiqiu on
I have a form names 'expiry' that users can choose a dealine date for their post as below
$form['expiry']=array(
'#title' => t('Deadline'),
'#type' => 'date_popup',
'#description' => t('Set the deadline.'),
'#default_value' =>$node->expiry,
);
My problem is how to save the date in to the table field when implementing the hook_ insert
I tried below but failed,the date users selected just can't be saved into the table field 'expiry'.
mymodule_insert ($node) {
db_query("INSERT INTO {exampletable} (nid,expiry) VALUES ( %d,%d) ", $node->nid,$node->expiry);
}
I don't know why,please help
Comments
Are you getting an error? Are
Are you getting an error?
Are you sure the form field is of type int and not string?
Why not just use CCK and a date field?