Chào mừng!

Bằng cách đăng ký với chúng tôi, bạn sẽ có thể thảo luận, chia sẻ và nhắn tin riêng tư với các thành viên khác trong cộng đồng của chúng tôi.

Đăng ký ngay!
  • Chào Khách,
    Bạn cần liên hệ với admin ??? ZALO & TELEGRAM

Hỏi - Đáp PHP search Time In SQL

Tham gia
28/2/19
Bài viết
240
Lượt Thích
274
Coins
19,170
MÃ HTML
HTML:
 <input type="text" class="date-picker" name="tungay" placeholder="Từ ngày" value="">
 <input type="text" class="date-picker" name="denngay" placeholder="Đến ngày" value="">
MÃ PHP
PHP:
$tungay= $_GET['tungay'];
$denngay = $_GET['denngay'];

if(isset($_GET['timkiem'])) {
    $result = mysql_query("SELECT * FROM `status`");
}
while($row = mysql_fetch_assoc($result)) {
Trong đó, time trong sql tính theo giây, VD như: 1553501001
Nhập vào input: 29/05/2019
Mn giúp e hoàn thiện cái search status theo thời gian giúp em với ạ
E cảm ơn nhiều
 
Tham gia
16/3/19
Bài viết
232
Lượt Thích
62
Coins
1,100
date picker phải dạng tháng/ngày/năm dùng strtotime($tungay), strtotime($denngay) dể convert sang timestamp . sql:
SELECT * FROM `status` where `col1` >= $tungay and `col1` <= $denngay

nếu column `time` trong sql để type datetime (month/day/year) luôn thì dùng SELECT * FROM `status` where `col` between $tungay and $denngay

định dạng ngày tháng để xử lí ai để ngày tháng năm bao h
 
Top Bottom
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock
No Thanks