PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 12th, 2004, 04:45 PM
crazycondor crazycondor is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 23 crazycondor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 50 sec
Reputation Power: 0
Polling Database with PHP?

Hello all,
My question is the following. I want to make an electronic reminder in which the user can loggin, add an event and specify the time that the app will send him an email. Is it possible to create a php function that will poll the database every minute in order to find the events? Is that the right way to do this or are they any other solutions?

Reply With Quote
  #2  
Old June 12th, 2004, 05:28 PM
blahpro blahpro is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 blahpro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hey,

I'm afraid I am a bit of a newbie, so this solution is more than likely flawed - there's probably also a better way to do it. This is just an idea of how I would go about it first time round!

You will need to write your script first, that queries the database for all records who's date and time has passed the current date and time. Then use a foreach loop to cycle through an array (obtained from the mysql_fetch_array() function) in order to:
  1. Use the mail() function to email the user(s).
  2. Drop the records from the database that contain send reminders, so that a reminder is not sent out again.
If you are running a Linux\Unix server, use cron to set the script to run every minute (click here for a got intro to cron). If you are running a Windows server, just set the script to run at the required interval by setting up a simple scheduled task. A good tutorial on how to do this on versions of since Win98 is located at http://www.iopus.com/guides/winscheduler.htm.

Like I say, give it a shot - its just an idea.

Hope I've helped!!

Regards,


Ben Hodgson

Reply With Quote
  #3  
Old June 13th, 2004, 01:09 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
in order to make the script usersite. You can use a <meta></meta> tag to reload the tjekpage veery so often. And this could be the logon page

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Polling Database with PHP?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway