darylr wrote:1. Im trying to get code for an elapsed amount of time. For example, I have a date in my database and if that is not updated in 30 days, the "active" field changes to "no" or whatever. I don't know if I've explained that carefully enough, but does anyone know how I can achieve this?
$thirty_days_ago = date('Y-m-d', strtotime('-30 days'));
$sql = "UPDATE table SET active = 'no' WHERE date < '$thirty_days_ago'";
darylr wrote:2. If I make a table with lets say 20 questions, what code can i use so that when someone requests, only 10 (random) questions appear?
SELECT * FROM questions ORDER BY RAND() LIMIT 10