I need a php function that can randomly select one row that has a unix time date field (like 2011-11-12 or 2011-12-24) that indicates the row was created within the last two weeks from a mySQL table and return the id of that said row.
I don’t know how do this. Honestly, I would like someone to hand me the code, but I don’t like that because most people don’t like that.. and their reasons make sense, but if someone would show me the code, then please do, thus can someone at the least point me in the right direction? Thank you.
You can get the date by using
dateandstrtotime:Then the query would look something like this:
ORDER BY RAND()gives you a random row.strtotime: https://www.php.net/manual/en/function.strtotime.phpHope this helps. 🙂