致命错误:在第105行的/webshop/index.php中调用未定义的函数tep_db_fetch_assoc()

时间:2010-10-09 18:22:28

标签: php oscommerce

有人给了我一段代码,但在实现了代码片段之后,标题中的错误得到了证实。

这是片段:

似乎tep_db_fetch_assoc()被定义为$ row,这是真的,为什么我会得到这个错误呢?

// Start auto fetch category image from product
if($categories['categories_image'] == "") {
$categories_img_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '{$categories['categories_id']}' AND p.products_image IS NOT NULL order by p.products_id ASC");

while ($row = tep_db_fetch_assoc($categories_img_query)) { 
  if ($row['products_image'] <> 'noimage.jpg' 
     or !isset($categories['categories_image']) 
  ) { 
     $categories['categories_image'] = $row['products_image']; 
  } 
} 
else {
 $categories_img_parent_query = tep_db_query("select categories_id from categories WHERE parent_id = '{$categories['categories_id']}'");

 while($categories_img_parent = tep_db_fetch_array($categories_img_parent_query)) {
   $categories_img_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '{$categories_img_parent['categories_id']}' AND p.products_image IS NOT NULL order by p.products_id ASC");
   while ($row = tep_db_fetch_assoc($categories_img_query)) { 
  if ($row['products_image'] <> 'noimage.jpg' 
     or !isset($categories['categories_image']) 
  ) { 
     $categories['categories_image'] = $row['products_image']; 
  } 
} 
 }
}
}
// End auto fetch category image from product

2 个答案:

答案 0 :(得分:0)

tep_db_fetch_assoc不存在。您要么缺少定义该函数的文件,要么函数名称不正确。尝试使用tep_db_fetch_array来查看它是否返回一个类似于tep_db_fetch_assoc的辅助数组。

答案 1 :(得分:0)

我不认为tep_db_fetch_assoc是php的功能,它是一个自定义功能。 确保包含包含该功能的库/类/文件