A Database Error Occurred
Error Number: 1054
UnkNown column ‘data’ in ‘field list’
SELECT
data
FROMci_sessions
WHEREid
=
‘dd8fddaabb45c365fbf27a6fdc5ea60d59f569e4’ ANDip_address
= ‘::1’Filename: libraries/Session/drivers/Session_database_driver.PHP
Line Number: 160
这是Session_database_driver.PHP
public function read($session_id) {
if ($this->_get_lock($session_id) !== FALSE)
{
// Needed by write() to detect session_regenerate_id() calls
$this->_session_id = $session_id;
$this->_db
->select('data')
->from($this->_config['save_path'])
->where('id', $session_id);
if ($this->_config['match_ip'])
{
$this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']);
}
if (($result = $this->_db->get()->row()) === NULL)
{
$this->_fingerprint = md5('');
return '';
}
// Postgresql's variant of a BLOB datatype is Bytea, which is a
// PITA to work with, so we use base64-encoded data in a TEXT
// field instead.
$result = ($this->_platform === 'postgre')
? base64_decode(rtrim($result->data))
: $result->data;
$this->_fingerprint = md5($result);
$this->_row_exists = TRUE;
return $result;
}
$this->_fingerprint = md5('');
return '';
}
解决方法:
根据CI手册关于Sessions
的基本格式
ci_sessions表的格式是:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(45) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id),
KEY `last_activity_idx` (`last_activity`)
);
$this->_db
->select('data')
->from($this->_config['save_path'])
->where('id', $session_id);
因此,通过将代码更改为:
$this->_db
->select('user_data')
->from($this->_config['save_path'])
->where('session_id', $session_id);
你的代码应该有效.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。