Using Drupal 7 and trying to store registration information into my own database.

I have a hook_form_submit() function that should be submitting the information into my own database table.

what it looks like:

 * Implementation of hook_form_submit().
 function loanpieuser_database_form_submit($form, &$form_state){
    // Array of information to save into drupal user's table
    $edit = array(
                  'f_name' => $form_state['values']['f_name'],
                  'l_name' => $form_state['values']['l_name'],
                  'second_email' => $form_state['values']['second_email'],

    user_save(drupal_anonymous_user(), $edit);

    // Set custom DB

    $dateFormatter = DateTime::createFromFormat('Y-m-d', $form_state['values']['dob']);
    $dob = $dateFormatter->format('Y-m-d');

    $nid = db_insert('loanpie_user')
                    'ssn' => $form_state['values']['ssn'],
                    'dob' => $dob,

    // Change back to Drupal DB

I do this and go back to check my database but no new column has been added.

Does Drupal require information about my external db tables or should it just be told that I want to insert x information into it? I have the credentials added in settings.php.

Is something wrong in this hook_form_submit function or would it be a database connection issue? I've tried to alter this function a million times.

closed as too broad by kiamlaluno Aug 5 '16 at 17:07

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to Drupal Answers! The code you are showing is not valid PHP code, nor code you would use in a module. As for why the database table not being populated, the reasons could be many, including the fact Drupal doesn't have a hook_form_submit() hook. Please show the real code you are using, including the part that helps us to understand in which context the main function is called. – kiamlaluno Jul 1 '15 at 6:04
  • @kiamlaluno I updated it. – Exziled Jul 3 '15 at 16:03