PDA

View Full Version : Reminder with PHP


SDP2006
07-04-2003, 03:39 AM
I am wondering, is it possible for someone to specify a time, store that time in a database, store a certain message in a database, and then send them the stored message at the time stored in the database? Sort of like a "reminder".

Can this be possible?

Thanks:thumbsup:

IronCode
07-04-2003, 05:03 AM
Yes, you'll need to setup a cronjob to run the script. You can have it run every second if you want. Do a seacrh on google for Cron +linux and you should have a good listing.

Just remember that your host needs to support it and give you access to setting it up.

Jeewhizz
07-04-2003, 12:42 PM
runnign a cron job every second will get you kicked off most servers unless you own it. Check with them what they see as a reasonable time limit (i'd say 5 minutes)

SDP2006
07-04-2003, 01:30 PM
Whats a cron job? But, I have a PC, whats the Linux thing?

ConfusedOfLife
07-04-2003, 02:05 PM
Originally posted by SDP2006
Whats a cron job? But, I have a PC, whats the Linux thing?

Well, Linux is an operating system. There are different flavors of linux, like Mandrake, Red Hat and ... that I'm sure you heard about the latter. A cronjob is a line of code listed in a table called cron table. Each entry of that table specifies a job to be excecuted on a special time that was specified. For specifying that job and also the excecution frequency, it's better that you look up Linux manuals and see it for yourself. You should put the time of month, day, seconds and stuff, you know what I mean.

Nightfire
07-04-2003, 02:15 PM
Can also get 'cron jobs' for windows. Never used it though

http://www.kalab.com/freeware/cron/cron.htm

SDP2006
07-04-2003, 02:21 PM
OK. I downloaded it from the link (above). What do I do next?

Nightfire
07-04-2003, 02:25 PM
It's all explained on the page above...

Setup for first version (Windows 9x/NT) ...

Setup for NT service ....

etc

SDP2006
07-04-2003, 02:33 PM
I'm a little confused. Is this to put on your PC or on a website. I wanted this to be done on my website.

Nightfire
07-04-2003, 02:35 PM
It's for use on your pc, not your web host. So you can practise using cron on your pc and get it right before it's on your host.

You'll need to check with your host if cron is available. If it isn't, I'd suggest moving to another host.

SDP2006
07-04-2003, 02:38 PM
Sorry if I am bothering, nightfire, but what I want to do is have a website, when someone signs up they can specify when they want a email reminder to their inbox. They will specify the time to be sent and the message they want to be in it. Then it would be emailed to them at the time they specified. I know this would have to incorporate SQL too.


Thanks:cool:

ConfusedOfLife
07-04-2003, 03:01 PM
Well, what you have to do is to run your script every hour or maybe each day. Then in that script you have to read the sql database, find those who should get the email, and then send them the email. I don't think that the minute or second of sending the email is that important, because then you have to run your script every second/minute which is not a good idea I think! If I were ya, I would have set a daily basis for that.

IronCode
07-04-2003, 03:03 PM
OK first of all the every second was not a suggestion but more and example of how often a cron CAN run. You are correct in warning him of being kicked off the server though. I didn't think anybody would take me serius about running one every second.

SDP2006 from the sound of it your on a virtual host. You'll need to contact your host and have them setup your Cron job for you if you don't have access to creat one. Normally they are in the "admin" section that your host provides you when you open an account.

SDP2006
07-04-2003, 04:15 PM
OK. Thanks guys.