Php codeigniter中的数据库错误是什么
我在codeigniter中发现以下错误 错误号码:1064Php codeigniter中的数据库错误是什么,php,mysql,codeigniter,Php,Mysql,Codeigniter,我在codeigniter中发现以下错误 错误号码:1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `appID` = 'buttn_default'' at line 2 SELECT `responseURL` WHERE `appID` = 'bu
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `appID` = 'buttn_default'' at line 2
SELECT `responseURL` WHERE `appID` = 'buttn_default'
这是我用来从数据库中获取数据的模态函数
function get_response_url($appID, $merchant_id)
{
$this->db->select('responseURL');
$this->db->from('response_urls');
$this->db->where('appID',$appID);
//$this->db->or_where('merchant_id',$merchant_id);
$query = $this->db->get();
if($query->num_rows() == 1)
{
foreach($query->result() as $row)
return $row->responseURL;
}
else
{
$appID='buttn_default';
$this->db->select('responseURL');
$this->db->where('appID',$appID);
$query = $this->db->get();
if($query->num_rows() == 1)
foreach($query->result() as $row)
return $row->responseURL;
}
}
为什么这不起作用。为什么我要设计这个错误。您的mysql错误显示active record的
from()函数没有from子句,并且您的else部分也丢失了。
else
{
$appID='buttn_default';
$this->db->select('responseURL');
$this->db->from('table_name_here'); <------
$this->db->where('appID',$appID);
$query = $this->db->get();
if($query->num_rows() == 1)
foreach($query->result() as $row)
return $row->responseURL;
}
else
{
$appID='buttn_default';
$this->db->select('responseURL');
$this->db->from('table_name_here');db->where('appID',$appID);
$query=$this->db->get();
如果($query->num_rows()==1)
foreach($query->result()作为$row)
返回$row->responseURL;
}
您的相关数据库表中的数据类型是什么appID
?是否可以激活探查器以获取查询,因为values@summea数据类型为varcharI在数据库中保存此值噢,这是否发生在else
语句中?你需要一个来自的,对吗?