奇怪的SQL错误IIS 7


Bizarre SQL bug IIS 7

我最近不得不修改以下SQL:

$this->db->select('StaffMembers.Id AS StaffMembers_Id, Contacts.AssociatedStaffMember_Id');
$this->db->join("StaffMembers", "Contacts.AssociatedStaffMember_Id=StaffMembers.Id");                   
$q1 = $this->db->get_where($this->contacts_table, 'Contacts.AssociatedStaffMember_Id ='.$ContactId);
$s = $q1->row_array(); 

然而,当我登录时,它显示一个旧的 SQL:

A Database Error Occurred
Error Number:
Invalid column name 'Contact_Id'.
SELECT Contacts.Id, StaffMembers.Id AS StaffMember_Id 
FROM StaffMembers JOIN Contacts ON Contacts.Id=StaffMembers.Contact_Id 
WHERE Contacts.Id =161

我已经重新启动了mssql服务器,刷新了memcached和iis7,但它仍然显示旧的查询。不知道,到底为什么要这样做,有什么想法吗?

发现问题,控制器类中似乎有一些重复的SQL(当不应该有!

修复了 - 问题已解决。干杯。

这是否以任何方式解决了问题?

$this->db->select('StaffMembers.Id AS StaffMembers_Id, Contacts.AssociatedStaffMember_Id');
$this->db->join("StaffMembers", "Contacts.AssociatedStaffMember_Id=StaffMembers.Id");  
$this->db->where('Contacts.AssociatedStaffMember_Id', $ContactId);
$q1 = $this->db->get($this->contacts_table);
$s = $q1->row_array();

您以前的代码使用的是get_where,我不能 100% 确定是否可以混合使用。

在运行此代码之前,是否有操作$this->db类的基础类?

加夫