dsjpqpdm620596 2016-12-28 10:31
浏览 38

从facebook codeigniter登录中保存数据

I have a problem in this part of my code, where i want to insert it my model named user_model with a function of checkUser2. How can i insert this data from my database, i have no error but i cannot var_dump the data that i want to insert into my database.

 public function facebook_request(){
        $this->load->library('facebook/src/facebook', array('appId' => '1027885817316593', 'secret' => '6db175699897b514bf4881955b2944bb'));
        $this->user = $this->facebook->getUser();
        if ($this->user) {
            $data['user_profile'] = $this->facebook->api('/me?fields=id,first_name,last_name,email,link,gender,locale,picture');

            // Get logout url of facebook
            $data['logout_url'] = $this->facebook->getLogoutUrl(array('next' => base_url() . 'index.php/oauth_login/logout'));
                $data = array(
                    'oauth_provider'=> 'facebook',
                    'oauth_uid'     => $data['user_profile']['id'],
                    'first_name'    => $data['user_profile']['first_name'],
                    'last_name'     => $data['user_profile']['last_name'],
                    'email'         => $data['user_profile']['email'],
                    'gender'        => $data['user_profile']['gender'],
                    'locale'        => $data['user_profile']['locale'],
                    'picture'       => $data['user_profile']['picture']['data']['url'],
                    'link'          => $data['user_profile']['link']
                );
                $userData = $this->user_model->checkUser2($data);

                var_dump($data);
            // Send data to profile page
            $this->load->view('admin/profile.php', $data);


        } 
        else {

            // Store users facebook login url
            $data['login_url'] = $this->facebook->getLoginUrl();
            $this->load->view('auth/profile.php', $data);
        }

with model :

 function checkUser2($userData){
    $this->db->insert('tbl_oauth', $userData);
    return $this->db->insert_id();
}

here is my table screenshot details: enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试