What I’m trying to do is display articles from the past 30 days, but the code I have in place keeps giving me a mysql_fetch_assoc error which then traces back to my query
This is the code:
$sql = mysql_query("SELECT *
FROM table
WHERE DATE (datetime) = (CURDATE() - INTERVAL 7 DAY)
ORDER BY ID DESC");
while ($runrows = mysql_fetch_array($sql))
Can someone give me pointers on how to actually make the code work properly? Here is the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Try this:
I’ve changed two things:
DATE_SUB()to subtract date.>=instead of just=to find all dates in the past week.