Solved

MySQL & PHP Code Question

Posted on 2011-03-25
7
207 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php string masking 4 29
get domain with php 7 20
How can I get this SlideToggle to behave? 6 18
Checking if varaible is empty 6 30
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now