Jump to content

Non-event-driven?


LunarMagic
 Share

Recommended Posts

This may not be a PHP question, but it's something I've been stumped on for quite some time.

 

I have PHP pages and MySQL databases. This all works great for me for almost everything. (I throw in some JavaScript if I need pop-up windows or dynamic stuff).

 

Now, is there any way, with any of that set up how it is, to cause it to send me a "reminder"? I would love to set up some sort of reminder database - or, say, when I have a database of clients, and they need recurring billing, can I create a script to send me an email when it gets within a month of needing to ask them for the next year's payment?

 

Would appreciate any conjecture, at this point. I have a few ideas, but there's got to be something simpler out there.

Link to comment
Share on other sites

Hi,

 

You need something to trigger / run a PHP script, so you can not do it as a "non-event-driven" command as far as I am aware.

 

There are 2 other possible solutions.

 

1. you create the script, and run it yourself on a regular basis, or attach it to a page / event that get's run at the right sort of frequency.

 

2. you set up a Cron Job to run on a monthly basis, which executes your PHP script to check the database and send out an email.

 

I'd go for option 2 myself :dance:

 

Andy

Link to comment
Share on other sites

  • 2 weeks later...

I've personally never used cron jobs before (for lack of knowing how), but here are a couple of links I found. It looks like you have to know Linux server commands.

 

The first link is how to write them. The page is weird... when you click on one of those links, it looks like the page just flickers. You have to scroll up to see the part of the page that changed.

 

This link is simply how to use CronJobs in CPanel.

Link to comment
Share on other sites

Lunar Magic, just create a simple PHP script that suits your needs and works as you want it to when you call it from a web browser. Then you just need to set up a cron job in Cpanel with the following command:

 

php -q /path/to/your/script.php

 

The timing stuff seems quite basic to me but if you have any doubts, post here and I'll give you a hand :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...