Let’s say I have records in a MySQL table that have a unix timestamp in it. How would I go searching, in a MySQL query, for a query that was posted on the current month?
Here’s what I have so far:
$sql = "SELECT * FROM `postings` WHERE `date_posted` = '".date("m-Y")."'";
Obviously — not right. Help?
As your column contains a time() field you’ll need values containing time values in order to compare. By using the function
strtotimeyou’ll achieve what you want.