`
cfpl0594
  • 浏览: 13155 次
  • 性别: Icon_minigender_2
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

open one products in every categories

阅读更多
<?php

require('includes/application_top.php');

$selectsql = "select categories_id from categories_description where language_id = 1";

$select_count_products_off = "select count(*) from products where products_status = 0";

$count_products_off = $db->Execute($select_count_products_off);

$cateid = $db->Execute($selectsql);

$i = 0;

while(!$cateid->EOF)
	{	
		$cateidone = $cateid->fields[categories_id];
		$updatesql = "update products set products_status = 1 where products_status = 0 and master_categories_id = ".$cateidone." limit 1";
		$db->Execute($updatesql);
		$select_categories_name = "select categories_name from categories_description where categories_id = " .$cateidone." and language_id = 1";
		$select_products_count_off = "select count(*) as cd from products where products_status = 0 and master_categories_id = ".$cateidone;
		$caterst = $db->Execute($select_categories_name);
		$prorst = $db->Execute($select_products_count_off);
		
		if($prorst) continue;
		
		$categrid[$i]['name'] = $caterst->fields[categories_name];
		$categrid[$i]['count'] = $prorst->fields[cd];
		$i = $i+1;
		$cateid->MoveNext();
	}
	echo 'It is ok !!!<br />';
	$select_products = "select count(*) as c from products where products_status = 0";
	$res = $db->Execute($select_products);
	echo 'left : '.$res->fields[c].'<br />';
	foreach ($categrid as $value)
	{
		echo $value['name'] . " : [".$value['count'].']<br />';
	}
?>

 

1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics