Iam new to drupal.I have created a custom module named firstmodule .I have created a form using the tutorials section of drupal 7 when is submit i want to store this details in the registration which is present in db.
firstmodule.module
function firstmodule_form1_submit($form, &$form_state)
{
$firstname = $form_state['values']['name'];
$username = $form_state['values']['username'];
$password = $form_state['values']['password'];
$year_of_birth = $form_state['values']['year_of_birth'];
$email = $form_state['values']['email'];
$file = $form_state['values']['file'];
I am using the insert query in the following way:
db_insert('registration')->fields(array(
'firstname' => $firstname,
'username' => $username,
'password' => $password,
'yearofbirth' =>$year_of_birth,
'email' => $email,
'file' => $file,))
->execute();
}
it is showing me the error
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2168 of /var/www/drupal-7.22/includes/database/database.inc).
please help with it