Jump to content
nutnkssr15

How can i automate a SQL update query?

Recommended Posts

Hey guys,

 

I have a script which ideally i'd like to run every 5 minutes.

 

The script basically connects to MySQL database, changes some ID's and thats it... But to save me from having to do it every time a customer places an order, i'd like something that would run the script for me, every 5 minutes.

 

I'm not familiar with cron jobs which someone suggested so i was just wondering if anyone could help me out here with some in-depth information? or as a colleague most lightly puts it a "Dummy guide to ease database management".

 

The script i run is currently in a .php file which i have bookmarked on my FireFox bar, and everytime i recieve an email, i click that button and it'll update the ID's.. but obviously over x-mas, when i'm not here, ill or whatever else and i dont run the script, it will generate a security issue so it's very important the script is run every 5 minutes atleast.

 

Thanks in advance!

Edited by burt
remove SPAM

Share this post


Link to post
Share on other sites

I don't know if it's appropriate for your application or not but you could always trigger it on a page call...ie someone visits one of your store pages and the call gets executed.

Dan

Share this post


Link to post
Share on other sites

Google is your best friend,

https://crontab.guru/every-5-minutes

  • Edit your cronjob file by running crontab -e command
  • Add the following line for an every-5-minutes interval.

    */5 * * * * /path/to/script-or-program

  • Save the file, and that is it.

 

However before you do this talk to your host as they normaly do not like Cron that run so often

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites
42 minutes ago, Dan Cole said:

I don't know if it's appropriate for your application or not but you could always trigger it on a page call...ie someone visits one of your store pages and the call gets executed.

Dan

This is the way to go.  If something needs to happen every time an order is placed...why not do it as (eg) a checkout_success mod.

EDIT:  I have just noticed that the OP is a spammer.  I have removed the hidden spam link, booted from the community - will leave the thread up as it's actually an interesting question.

Edited by burt

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×