How is the data in the range of the day of the PHP query written?

Source: Internet
Author: User
PHP connection MySQL database to query the time of day (or some time) in the range of data, such as to query the day 17:25-17:35 between the data received in the database, what should be written?


Reply to discussion (solution)

Select ... where time between start and end

SELECT * FROM table where addtime>= '??? ' and addtime<= '?

I only look at the data of the day, the writing upstairs to the database this time all the data are found.

Select ... where time between start and end


How do you write the data on the "Time" day?
How do you write "Start and end" time in seconds?
I'm going to look at the data at this point in time every day, not on a particular day.

SELECT * FROM table where addtime>= '??? ' and addtime<= '?


I only check the data of the day, how to write the data of the day?
How do you write "Start and end" time in seconds?
I'm going to look at the data at this point in time every day, not on a particular day.

Date_format () into the time format you want, then go to query. But the efficiency will be low.


SELECT * FROM table where addtime>= '??? ' and addtime<= '?


I only check the data of the day, how to write the data of the day?
How do you write "Start and end" time in seconds?
I'm going to look at the data at this point in time every day, not on a particular day.



$starttime = ' 17:25:00 ';
$endtime = ' 17:35:00 ';

$sql = "SELECT * from table where addtime>= '". Date (' y-m-d '). ' '. $starttime. ' and addtime<= '. Date (' y-m-d '). ' '. $endtime. ' ";

The original landlord's date and time is divided into two fields, then you have to use the date + time to form a new value, date + Time >= '?? ' and date + time <= '? '



SELECT * FROM table where addtime>= '??? ' and addtime<= '?


I only check the data of the day, how to write the data of the day?
How do you write "Start and end" time in seconds?
I'm going to look at the data at this point in time every day, not on a particular day.



$starttime = ' 17:25:00 ';
$endtime = ' 17:35:00 ';

$sql = "SELECT * from table where addtime>= '". Date (' y-m-d '). ' '. $starttime. ' and addtime<= '. Date (' y-m-d '). ' '. $endtime. ' ";


Thank you very much moderator, already OK, ask this aspect of knowledge should from which books, or Baidu What can find, I just started to learn, I find the book and video only speak basic query, insert, delete operation, further details are not.

#3 I only look at the data of the day, the writing upstairs to the database this time all the data are found.
#4 I'm going to look at the data in this point-in-time range every day, not the data for a particular day.

So what are you going to look for?




SELECT * FROM table where addtime>= '??? ' and addtime<= '?


I only check the data of the day, how to write the data of the day?
How do you write "Start and end" time in seconds?
I'm going to look at the data at this point in time every day, not on a particular day.



$starttime = ' 17:25:00 ';
$endtime = ' 17:35:00 ';

$sql = "SELECT * from table where addtime>= '". Date (' y-m-d '). ' '. $starttime. ' and addtime<= '. Date (' y-m-d '). ' '. $endtime. ' ";


Thank you very much moderator, already OK, ask this aspect of knowledge should from which books, or Baidu What can find, I just started to learn, I find the book and video only speak basic query, insert, delete operation, further details are not.



Look at some sources of source system?
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.