$id=1;
while($id > 0)
{
$id=0;
$id=mysql_query("SELECT b_catalog_product.ID FROM b_catalog_product LEFT JOIN b_iblock_element ON (b_catalog_product.ID=b_iblock_element.ID) WHERE b_iblock_element.ACTIVE='N' AND b_catalog_product.QUANTITY >0 LIMIT 0,1");
$id=mysql_fetch_row($id);
$id=$id[0];
if($id > 0)
{
mysql_query("UPDATE b_catalog_product SET QUANTITY='0',QUANTITY_TRACE='Y' WHERE ID='{$id}'");
}
else
{
$id=0;
}
}
//echo "That's all3!!!"; |