$username = 'teddy bear'; $uid = $db->fetch_field($db->simple_select('users', 'uid', 'username="'.$db->escape_string($username).'"'), 'uid');