面对以下错误
错误:注意:第120行的/Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/upload/admin/controller/catalog/vendhqbridge.php中的未定义索引:id
相关代码:
//check for existing 'VendHQ_id' on DB's product table
function checkVendHQid($flagChk)
{
$rs = $this->db->query("SELECT vendhq_id as id FROM ".DB_PREFIX."vendhq_product WHERE vendhq_id = '".$flagChk."'");
$rowRsl=-1;
if($rs===null)
{
$rowRsl = -1;
}
else
{
if($rs->row["id"] == $flagChk )
{
$rowRsl = 1;
}
}
return $rowRsl;
}
答案 0 :(得分:7)
在FROM
$rs = $this->db->query("SELECT vendhq_id as id FROM ".DB_PREFIX."vendhq_product WHERE vendhq_id = '".$flagChk."'");
答案 1 :(得分:0)
如Vikas Umrao和shadyyx所述,您应该更改查询和if条件,如下所示:
更改
$rs = $this->db->query("SELECT vendhq_id as id FROM ".DB_PREFIX."vendhq_product WHERE vendhq_id = '".$flagChk."'");
$rowRsl=-1;
if($rs===null)
要强>
$rs = $this->db->query("SELECT vendhq_id as id FROM ".DB_PREFIX."vendhq_product WHERE vendhq_id = '".$this->db->escape($flagChk)."'");
$rowRsl=-1;
if(!$rs->num_rows){
度过美好的一天!!