那么我宁愿建议您将此fetching
功能更改为可以计算行数的功能
$result = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_tax_class_id = '3' and products_id = '".$items[$i]['id']."'");
$get_now = mysql_num_rows($result);
if ($get_now > 0)
{
//we've found it
}
else
{
//not found
}
注意我使用了mysql_num_rows
因为oscommerce
没有为此声明的函数
UPDATED
如果您想获取所有产品并检查它们是否有tax_class_id = '3'
,您可以全部获取它们然后选择。
$result = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_id = '".$items[$i]['id']."'");
if($get_now = tep_db_fetch_array($result))
{
if ($get_now['products_tax_class_id'] == '3')
{
//this product have class = 3 do something
}
else
{
//this product haven't class = 3 do something else
}
} else {
//this is just a check for wrong products_id you can avoid this else since products are already in the shopping cart and it's not possible they have wrong products_id
}