Hi, I'm not sure whether this is the best section to ask about this but here we go anyway..
I'm trying to automatically mark a range of products as out of stock, when I run this via 'Install SQL Patches' everything works great:
Code:
UPDATE products SET products_status = 1 WHERE products_quantity >= 3;
UPDATE products SET products_status = 0 WHERE products_quantity <= 2;
What I'm trying to work out is how I would go about running an SQL query via a cron job. This is how I have the command in CPanel:
Code:
php /home/trymarket/public_html/admin/stockupdate.php
and this is stockupdate.php:
PHP Code:
// filename: stockupdate.php
// make changes in /admin/init_includes/init_admin_auth.php
if ($_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR']) {
define('CRON_ADMIN_USER_ID', '99');
}
// your code to run via cron
// Updates stock
$sql="UPDATE products SET products_status = 1 WHERE products_quantity >= 3";
$sql="UPDATE products SET products_status = 0 WHERE products_quantity <= 2";
Unfortunately this is not working and am pretty certain it's to do with the way I've set up the SQL functions in my php script. If someone could help me with this it would no-doubt also help me with another SQL query I'm hoping to run via cron job, which is along these lines for marking up product prices:
Code:
UPDATE products SET products_price = products_price *1.25 WHERE master_categories_id = 32;
Any help with this would be appreciated ;-)