$query=sprintf("SELECT * FROM membertable WHERE (name='%s' AND pass='%s') AND activation='%s';",
$username,$password,"NULL");
$query=$this->db->query($query);
$result=$query->result_array();
我想将结果分配给_SESSION但是
session_start();
$_SESSION=$result;
会导致错误的结果,有人可以帮我解决这个小问题吗?
答案 0 :(得分:0)
打开application/config/autoload.php
,在$autoload['libraries']
数组中添加'会话':
$autoload['libraries'] = array(
'session'
// you may have some other libraries in here too
);
现在,要存储结果,请使用
$this->session->set_userdata('db_result', $result);
并检索它
$this->session->userdata('db_result');