Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 奇怪的SQL错误IIS7_Php_Sql_Codeigniter_Iis 7 - Fatal编程技术网

Php 奇怪的SQL错误IIS7

Php 奇怪的SQL错误IIS7,php,sql,codeigniter,iis-7,Php,Sql,Codeigniter,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->g

我最近不得不对此修改以下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


Gav

您是否在CodeIgniter中使用某种查询缓存机制?不,我不知道,有没有快速检查的方法?在配置文件(application/config/database.php)中查找设置
$db['default']['cache\u on']
值的行。如果不只是使用默认值,请确保检查应用程序的配置文件。它设置为false:$db['default']['dbprefix']=”$db['default']['pconnect']=TRUE$db['default']['db_debug']=TRUE$db['default']['cache_on']=FALSE$db['default']['cachedir']=“”$db['default']['char\u set']=“utf8”$db['default']['dbcollat']=“utf8\u常规\u ci”;您可以尝试添加
$this->db->flush_cache()在开始select语句之前,确认它是/不是缓存。解决了问题,控制器中似乎有一些SQL代码导致了问题。我必须把它移走。