AF_staff
03-03-2014, 01:25 AM
Hi everyone!
I am developing a product that has an Enable/Disable option. What I am trying to accomplish is when the Disable option is selected from the product's setting, it will run an UPDATE sql.
My product option is shop_enabled (Yes/No).
PHP code is
if(!$vbulletin->options['shop_enabled'])
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET coupon=0 WHERE coupon=1");
}
But it doesn't run at all.
I don't think it has something to do with me not being able to execute SQL queries from the admincp. I am using an admin username which is allowed to run queries (userid is declared in the includes/config.php).
Any help is greatly appreciated. Thanks! :)
EDIT: It is working if I visit my custom page. It think I just need something for it to run within the admincp page. Anyhow, this is somehow solved for now.
I am developing a product that has an Enable/Disable option. What I am trying to accomplish is when the Disable option is selected from the product's setting, it will run an UPDATE sql.
My product option is shop_enabled (Yes/No).
PHP code is
if(!$vbulletin->options['shop_enabled'])
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET coupon=0 WHERE coupon=1");
}
But it doesn't run at all.
I don't think it has something to do with me not being able to execute SQL queries from the admincp. I am using an admin username which is allowed to run queries (userid is declared in the includes/config.php).
Any help is greatly appreciated. Thanks! :)
EDIT: It is working if I visit my custom page. It think I just need something for it to run within the admincp page. Anyhow, this is somehow solved for now.