I have an question about show data table based on date. In this case I want to show data based on today and yesterday.
Design table :
form_no | model_name | prod_status | date_added
Example data :
1 | acer | OK | 12-APR-2013
2 | acer | NG | 11-APR-2013
So if in table I just want the data will show once, because the model name is same.
Table view Like this
No | Model | Yesterday Status | Today Status
1 | acer | NG | OK
and here is my code :
$today = date("j-F-Y");
$yesterday = date("j-F-Y, time() - 60 * 60 * 24;");
$query = "SELECT model_name, prod_status, date_added FROM t_production_status WHERE date_added like '$today%'";
$result = mysql_query($query);
Now I'm done show data by today in table, now I want to display yesterday status to table view.
You can do it as below.
SELECT *
FROM tableName
WHERE date BETWEEN (CURDATE() - INTERVAL -1 DAY) AND CURDATE()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With