Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i automate a SQL update query?


nutnkssr15

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!

Link to comment
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

Link to comment
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

 

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...