Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Trying to get all id's whose DateTime records are 15 minutes from now

Posted on 2013-06-16
3
Medium Priority
?
411 Views
Last Modified: 2013-06-16
Hi,
I'm setting up a cron function running every 15 minutes that checks a column called 'scheduled' for datetimes that are 15 minutes from now and retrieves each campaign_id so I can send out a reminder email about that upcoming campaign.

Records can be saved in 15 minute values only, for example:
2013-06-13 11:00:00 or 2013-06-13 11:15:00 or 2013-06-13 11:30:00 or 2013-06-13 11:45:00

Any idea what a query may look like?

mysql_query("SELECT campaign_id FROM messaging WHERE scheduled = ???...");

Any help would be much appreciated.
0
Comment
Question by:tjyoung
[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
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39251333
$future = date('c', strtotime('NOW + 15 MINUTES'));
$query = "SELECT campaign_id FROM messaging WHERE scheduled = '$future' ";

If you're actually using the MySQL extension, you may want to make a change.  PHP is removing support for MySQL.  This article explains why and what you must do to keep your scripts running.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
0
 
LVL 1

Author Closing Comment

by:tjyoung
ID: 39251340
Many thanks as always.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39251353
Glad to help -- thanks for the points.  You might also find this article helpful.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

Best regards, ~Ray
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

660 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