返回默认值面对以下错误MySQL的选择查询结果为空我怎么能在PHP
Error: Notice: Undefined index: id in /Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/upload/admin/controller/catalog/vendhqbridge.php on line 120
相关代码:
//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;
}
此外,如果'$ flagChk'将会被转义:'$ this-> db-> escape($ flagChk)''。 – shadyyx