Question and answer is powered by AnsPress.io
I can fetch the values by time range in PHP. How could I get the time register to be last 10 days?
I think you need to try this code.
<?php
$s_date = date(‘Y-m-d’);
$e_date = date(‘Y-m-d’,strtotime(‘+10 days’));
$sql = ‘SELECT * FROM tablename WHERE DATE_FORMAT(timeregister, “%Y-%m-%d”) BETWEEN “‘.$s_date.'” AND “‘.$e_date.'”‘;
?>
I hope it will be helpful for you.