tomb321 Posted January 18, 2014 Share Posted January 18, 2014 I know how to setup a CRON job and I know how to do an SQL query to make database changes .My problem is the development of the php file that the CRON job runs so I don't have to do the SQL query manually. (If there is an easier way to get this done, please let me know.) I'm trying to get the product status changed to inactive when the quantity is 0. What I have so far is: <$php require('includes/functions/database.php'); tep_db_connect() or die('Unable to connect to database server!'); $sql = "UPDATE products SET products_status = 0 WHERE products_quantity = 0"; $result = mysql_query($sql); tep_db_close(); ?> But it's not working (I'm not a coder). Any help with this would be appreciated. Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 19, 2014 Share Posted January 19, 2014 Try including the application_top.php file. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tomb321 Posted January 19, 2014 Author Share Posted January 19, 2014 Thanks, but still not working. Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 19, 2014 Share Posted January 19, 2014 It should work. This is what the code should look like require('includes/application_top.php'); tep_db_query("UPDATE products SET products_status = 0 WHERE products_quantity = 0"); Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tomb321 Posted January 20, 2014 Author Share Posted January 20, 2014 I'm getting the following error: <br /> <b>Warning</b>: require(includes/application_top.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in <b>/home/xxxxxxx/public_html/xxxxxx/includes/test.php</b> on line <b>3</b><br /> <br /> <b>Warning</b>: require(includes/application_top.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in <b>/home/xxxxxxx/public_html/xxxxxx/includes/test.php</b> on line <b>3</b><br /> <br /> <b>Fatal error</b>: require() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/application_top.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/xxxxxxx/public_html/xxxxxxx/includes/test.php</b> on line <b>3</b><br /> Line 3 is require('includes/application_top.php'); application_top.php is there Full code <?php require('includes/application_top.php'); tep_db_query("UPDATE products SET products_status = 0 WHERE products_quantity = 0"); ?> Link to comment Share on other sites More sharing options...
Dan Cole Posted January 21, 2014 Share Posted January 21, 2014 @@tomb321 Try moving your test.php file up a level so it's in the root directory. That should work... Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
MrPhil Posted January 21, 2014 Share Posted January 21, 2014 You were already in the "includes" directory (folder), so trying to find "includes/application_top.php" isn't going to work. You would either have to require just "application_top.php", or as Dan suggested, move your script up one level so that "includes/application_top.php" can be found. Frankly, if you're having that much trouble with such basic PHP, I fear for your ability to do the rest of it. At the very least, back up your files and database (and make sure they're good backups) before running this thing on a live database. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.