CI_session和错误编号:1054(未知列...) [英] CI_session and Error Number: 1054 (Unknown column ...)

查看:253
本文介绍了CI_session和错误编号:1054(未知列...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ci_session的问题。当我使用Active Record创建查询时,我使用会话,它抛出错误号:1054.
它是由Session.php引起的。我使用数据库会话,当它执行sess_write(),那么它会引发错误。

I have got problem with ci_session. When I am creating query with Active Record and I use session, it throws me Error Number: 1054. It is caused by Session.php . I am using database session and when it executes sess_write(), then it throws error.

我可以创建新的$ instance-> db实例吗?
错误在行号。 289在Session.php中

Can I create new instance of $this->db ? Error is at line no. 289 in Session.php

$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata)); 

在这个地方设置$ this-> CI-> db-> order_by('something') ,从我的代码,在我调用$ this-> session之前,这是我的问题。

In this place is set $this->CI->db->order_by(‘something’), from my code, before I call $this->session and this is my problem.

EDIT(13:12):

EDIT (13:12):

Unknown column 'contract.created' in 'order clause'

UPDATE `ci_sessions` SET `last_activity` = 1393330303, `user_data` = 'some_data' WHERE `session_id` = 'ea330d7194f902b6b38b88d509766560' ORDER BY `contract`.`created` DESC LIMIT 30

Filename: C:\Apache24\htdocs\Trokadero_v5\system\database\DB_driver.php

编辑2:

我相信,它是由Active Record发生,因为AR任务的顺序是:

I am sure, it is happening by Active Record , because sequence of AR tasks is:

My_controller.php

My_controller.php

$this->db->order_by('contract.created', 'DESC');
$this->session->set_flashdata('order_by_direction', 'DESC');

然后在Session.php中执行,并使用我自己的order_by子句

And then is executing in Session.php, with my own order_by clause

$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata));


推荐答案

$this->db->order_by('contract.created', 'DESC');
// add line of code to get data. After getting data, reset the db object.
$this->db->_reset_write();
$this->session->set_flashdata('order_by_direction', 'DESC');

这篇关于CI_session和错误编号:1054(未知列...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆