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 />';
	}
?>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值