Continuously check MySQL table (scheduler)

Codes here !

Moderators: macek, egami, gesf

xgab
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Jan 28, 2003 4:22 am

Continuously check MySQL table (scheduler)

Postby xgab » Tue Jan 28, 2003 5:07 am

Hi! I would need to build a scheduler system using PHP-Apache-MySQL under Windows or Linux, that enable me to schedule pager messages to different users.

There should be a form from which a user would post his preferences, telling the system that he wants to receive a certain kind of pager message for example each: Mon-Wed-Fri at 8am, etc, etc and schedule his messages.


From my side, I think there should be a process that continuously checks the MySQL tables to see if there is any pending messages to be sent on that moment and accept new ones.

Any idea on how to build it ?
Do you know any Open Source solution ?

I look forward to your quick reply
Thank you very much in advance!
Gabriel

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Tue Jan 28, 2003 3:14 pm

I dunno...
you mean a program that stays all the time connected and alerts you whenever there's a new message??
Something like a mail app such Outlook?

xgab
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Jan 28, 2003 4:22 am

Postby xgab » Tue Jan 28, 2003 5:26 pm

Thank you for your quick reply!

Yes, similar to that.

In order to give you the exact example, the MySQL table would have columns and rows like:

TIME SCHED PIN# Message text
10:00 111800 This message has to be sent at 10:00
11:56 111546 This message has to be sent at 11:56
14:33 111120 This message has to be sent at 14:33
.
.
And so on...


So the program that stays 24 hours connected, will do nothing from 00:00 to 9:59; at 10:00 will send its first scheduled message to a pager by posting a form to a Web Server's CGI.

From 10:01 to 11:55 will do nothing (but connected) and at 11:56 will send its second message... and so on.

Hope I am clear

Thank you very much
Gabriel

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Wed Jan 29, 2003 2:22 am

Well,
first off you will need to keep your browser opened if you want to see the mesages.
Then you could mata tags to refresh the page on a certain moment.
You could use:

Code: Select all

<?php
$seconds=5;
?>
<META HTTP-EQUIV="Refresh" CONTENT="<?php echo $seconds; ?>; URL=<?php echo $php_self."?redirect=ok"; ?>">
</HEAD>

This is an example...
you have to implement it with the database.
:)

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Fri Jan 31, 2003 2:22 am

Another that I see this would work is by using a cronjob to check the server at set intervals to see if there are any pending messages. This way you are not dependent on having a web browser open.

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Fri Jan 31, 2003 5:19 am

mmm,
I didn't know about cron 8O
Very interesting indeed :D
http://www.phpfreaks.com/tutorials/28/0.php

xgab
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Jan 28, 2003 4:22 am

Postby xgab » Tue Feb 18, 2003 4:56 am

Thank you all for your help.

I have found a great cron emulator for Windows at:
http://www.nncron.ru/

Thank you!


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests