Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:03:55+00:00 2026-06-11T05:03:55+00:00

The system is for phone contract comparison. Originally we could filter the result by

  • 0

The system is for phone contract comparison. Originally we could filter the result by length, given in months. However we’ve opted to storing this as a timestamp of the end date of contract in the database.

The original PHP was as follows:

$min = min($_POST["length"])-6;
$max = max($_POST["length"]);
$query[] = "length BETWEEN $min AND $max";

In summary, here’s what we have at the moment:

  1. In the database is stored the end-date of the contract (as a timestamp)

  2. The post value contains how many months from now it should last (eg. 7-12 months would have a value of 7)

How can we change the PHP calculations to get the between values from the database?

Many thanks, Nick.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:03:57+00:00Added an answer on June 11, 2026 at 5:03 am
    <?php
        $diff = 7;     // This may be set to $_POST['length']
        $max = date("Y-m-d");
        $min = date("Y-m-d", strtotime("$diff months ago"));
        $query[] = "DATE(`timestamp_field`) BETWEEN CAST($min AS DATE) AND CAST($max AS DATE)";
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how do I add windows phone system colors to icon using expression
I have a library that interacts with our phone system, ie, Hey phone, call
I'm designing a player application to accompany our phone system. As our calltakers take
I have made a phone bill system takes input of phone number called, date
How can I receive notification of system boot on the installed windows phone 7.5
I cant Uninstall/change windows phone 7.1 sdk. It has allready installed in my system.
I'm getting an exception with this code; InnerException: System.InvalidOperationException Message=The specified type was not
I currently have written an API to a SIP phone system, and would like
I have a phone system that calls a PHP script to send an email
I need to play videos from Youtube as MP4. My system (an Android Phone)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.