Solved

MySQL & PHP Code Question

Posted on 2011-03-25
7
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

635 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