Here is the code to update the stock of items belongs to table of products_licences . But this code also change the items that is not belong to the products_licences. So any item not belong to products_licences will be update as stock=0.
What should I do? I am a novice of php.
PHP Code:$dbres = $db->Execute('SELECT count(*) AS count FROM products_licences'
. ' WHERE products_id='.$this->products[$i]['id'].' AND orders_id IS NULL'
);
$db->Execute('UPDATE deals_products SET products_quantity='.$dbres->fields['count'].' WHERE products_id='.$this->products[$i]['id']);



