Tell me how to do it so that only data for a certain period of time is pulled out of the database. I need to make sure that only the data for the next 30 days would be pulled out of the database. That is, now the cells have records that were added earlier.
Here is a piece of code:
$res = mysql_query("select * from user ORDER BY ref DESC limit 20 "); $cont = mysql_fetch_assoc($res);
Now it pulls out all the records… But how to do it as written above? Need to create a cell with time?
Answer 1, authority 100%
If the data is in Unix format, then this:
WHERE time > UNIX_TIMESTAMP( curdate() - interval 30 day )