How to insert checkbox value in MySQL database $languages_knows=array(
'English' =&gt;t('English'),
'Hindi' =&gt; t('Hindi'),
'Marathi' =&gt; t('Marathi')
 );

$form['languages_known'] = array(
'#title' =&gt; t('Language Spoken'),
'#options' =&gt; $languages_knows,
  '#type' =&gt; 'checkboxes'
);
function lawyer_register_form_submit($form, $form_state)
{
//Does something with successfully submited form fields.
global $user;
 $user = db_insert('lawyer_details')
-&gt;fields(array(
'first_name' =&gt; $form_state['values']['first_name'],
'middle_name' =&gt; $form_state['values']['middle_name'],
'last_name' =&gt; $form_state['values']['last_name'],
'languages_known'=&gt;$form_state['values']['languages_known'],
))-&gt;execute();


Please help me.they gives error


  PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {lawyer_details} (first_name, middle_name, last_name, street_address, city, country, phone, email_id, speciality, languages_known) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9);
'checkboxes' are array - serialize values on insert (and unserialize when get it), something as 

'languages_known'=&gt;serialize($form_state['values']['languages_known'])


edit:

full working code for example form 

function mymodule_menu() {
  $items['test-form'] = array(
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('test_form'),
    'access callback' =&gt; TRUE,
  );

  return $items;
}

function test_form($form, &amp;$form_state) {

  $languages_knows=array(
    'English' =&gt;t('English'),
    'Hindi' =&gt; t('Hindi'),
    'Marathi' =&gt; t('Marathi')
  );

  $form['languages_known'] = array(
    '#title' =&gt; t('Language Spoken'),
    '#options' =&gt; $languages_knows,
    '#type' =&gt; 'checkboxes'
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),
  );

  return $form;
}

function test_form_submit($form, &amp;$form_state) {
  //Does something with successfully submited form fields.
  global $user;

  $user = db_insert('lawyer_details')
    -&gt;fields(array(
      //'first_name' =&gt; $form_state['values']['first_name'],
      //'middle_name' =&gt; $form_state['values']['middle_name'],
      //'last_name' =&gt; $form_state['values']['last_name'],
      'languages_known'=&gt;serialize($form_state['values']['languages_known']),
    ))-&gt;execute();
}


also you need to have install file, same as mymodule.install with table/field schema:

&lt;?php

function mymodule_schema() {
  $schema['lawyer_details'] = array(
    'description' =&gt; 'Details comments here.',
    'fields' =&gt; array(
      'id' =&gt; array(
        'type' =&gt; 'serial',
        'not null' =&gt; TRUE,
        'description' =&gt; 'Some identifier.',
      ),
      'languages_known' =&gt; array(
        'type' =&gt; 'varchar',
        'length' =&gt; 255,
        'not null' =&gt; TRUE,
        'description' =&gt; 'Some description here.',
      ),
    ),
    'primary key' =&gt; array('id'),
  );

  return $schema;
}


then delete your table, uninstall module (uncheck, save, uninstall) and install again. 

test

hint: see https://www.drupal.org/node/159605 for schema field definition