Solved

MySQL & PHP Code Question

Posted on 2011-03-25
7
212 Views
Last Modified: 2012-05-11
I have a MySQL database named FLOW. It has a table named INFO. In the info table I have a field named DUE_DATE. I need some type of script that I can put in a scheduled task that will run & look at the DUE_DATE & if the DUE_DATE is within 6 days of todays date, it will call other script I have named EMAIL_EMPLOYEES.php

I'm not sure what programming language would be better to use. If someone could help me get started with the proper code I'd greatly appreciate it. Thanks!

0
Comment
Question by:wantabe2
  • 3
  • 3
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 35218663
what is your plateform ? linux ? unix ? windows ?

http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_23151730.html
SELECT COUNT(*) FROM INFO WHERE DUE_DATE BETWEEN now() AND (now() - interval 6 day)

Open in new window

0
 
LVL 17

Expert Comment

by:nanharbison
ID: 35220247
I think you are looking for a cron job. Try googling it. Are you on your own server or using a webhost? Most webhosts provide the ability to create a cron job pretty easily.
0
 
LVL 15

Author Comment

by:wantabe2
ID: 35222787
This is on a Windows box using WAP as the web server...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Author Comment

by:wantabe2
ID: 35222790
WAMP not WAP. I'm using WAMP
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 35223554
you can use the MS task scheduler :
http://php.net/manual/en/install.windows.commandline.php
http://msdn.microsoft.com/en-us/library/aa383614(v=vs.85).aspx

with the result from the query you can run the entire script, something like :


<?PHP

include "includes/connect.inc";

$query = "SELECT COUNT(*) FROM INFO WHERE DUE_DATE BETWEEN now() AND (now() - interval 6 day)";
$result = mysql_query($query,$connexion);
$row = mysql_fetch_assoc($result);

if( $row[0] != "0" ) {
   header('Location: EMAIL_EMPLOYEES.php');
}

?>

Open in new window

0
 
LVL 15

Author Comment

by:wantabe2
ID: 35224355
What does $connexion refer to?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35224360
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question