dq05304 2017-05-02 11:14
浏览 60
已采纳

在codeigniter中执行插入查询后的空白页

After executing the below query , codeigniter displays a blank page, i think there is a syntax error in the insert query and also not able to print the query. Please help

My Model code is as follows:

function add_new_user($email,$password,$username)
{

    $sqls="INSERT INTO pr_users (username,userpass,email,departmentid,userroleid,managerid,userlevel,branchid,is_global,registrationtime,timemodified,modifierid,status,deleted,temppass,temppassvalidtill,lastlogin,lastrefresh,lastloginip,if_online,pfield) values ('".$email."','".65e1b655a6d6f4cbed20554d3b52521a743afdc0."','".$email."','".1."','".4."','".10."','".4."','".2."','".0."','".0."','".1491557947."','".1."','".1."','".0."','".."','".0."','".1492084067."','".1492084083."','".::1."','".0."','".unfold983$."')";
    $query=$this->db->query($sqls);

    $result = $this->db->last_query();  
    return $result;

}
  • 写回答

3条回答 默认 最新

  • dpg76975 2017-05-02 11:26
    关注

    Try this

    function add_new_user($email,$password,$username)
    {
        $sqls="INSERT INTO pr_users (username,userpass,email,departmentid,userroleid,managerid,userlevel,branchid,is_global,registrationtime,timemodified,modifierid,status,deleted,temppass,temppassvalidtill,lastlogin,lastrefresh,lastloginip,if_online,pfield) values ('$email','65e1b655a6d6f4cbed20554d3b52521a743afdc0','$email','1','4','10','4','2','0','0','1491557947','1','1','0','','0','1492084067','1492084083','1','0','unfold983$')";
        $query=$this->db->query($sqls);
    
        if ($this->db->affected_rows() > 0) {
            echo "Success";
            # return TRUE;
        } 
        else {
            echo "failed";
            # return FALSE;
        }
    
    }
    

    Note: Make sure in index.php(in root) environment is development

    define('ENVIRONMENT', 'development'); # line 21
    

    As well Highly Recommended to use Codeigniter Query Builder Class

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 数据结构—复杂度分析
  • ¥15 如何使用单链表编写学生信息管理系统?
  • ¥15 完成课题以及ppt 在21号之前完成
  • ¥15 懂的来,你应该知道我在说什么,我需要你的帮助
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 maccms影视模板 制作影视网站失败 求
  • ¥15 stm32按键设置闹钟数进退位不正常
  • ¥15 自己写的测试驱动程序无法启动
  • ¥15 三电平逆变器中点电位平衡问题
  • ¥20 这怎么写啊 java课设