1

when giving curr_date='2019/07/02' its working,but when giving curr_date='$b' not working

$b = date("Y-m-d",strtotime("yesterday"));

$sql = "SELECT * 
        FROM tbl_order_item 
        WHERE item_selected ='liquor' 
          and curr_time  BETWEEN '17:00:00' AND '24:00:00' 
          AND '1:00:00' 
          and item_name LIKE 'd%' 
          and curr_date='$b'";
Qirel
  • 25,449
  • 7
  • 45
  • 62
sss
  • 11
  • 1

1 Answers1

1

Instead of - dash in your $b = date("Y-m-d",strtotime("yesterday")); use / slash

Also Modify the BETWEEN clause because it takes only two values e.g

$b=date("Y/m/d",strtotime("yesterday")); # see here Y/m/d

$sql="SELECT * FROM tbl_order_item WHERE item_selected ='liquor' and  
curr_time  BETWEEN '17:00:00' AND '24:00:00' and item_name  
LIKE 'd%' and curr_date='$b'";
A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103