How to get logged user id?
It works when $uuid is initialized inside the function. 

function emailf_form_submit($form, &amp;$form_state) {
  global $user;
  $uuid = $user-&gt;uid;

  $bb = $form_state['values']['emailf'];
  $query = db_update('users')
    -&gt;fields(array('email_f' =&gt; $bb))
    -&gt;condition('uid', $uuid, '=')
    -&gt;execute(); 

  drupal_set_message('Email frequency successfully changed');  
}