I have a simple query:
$query1="SELECT * FROM wp_users WHERE now() < (last_login + INTERVAL 6 month)";
$result1=mysql_query($query1) or die(mysql_error());
while($rows=mysql_fetch_array($result1)){
$inactive_accounts[] = $rows['ID'];
}
I want it to pull in all user_id’s of people who have not logged into their account for 6 months. I have it set so when they log in, it inseerts datetime into the last_Login column.
I just wondered if this SELECT query was ok, as I am having trouble testing it. Will this show ID’s of people who have not logged in for 6 months?
Thanks!
You’re on the right lines. What you probably need is something like the DATE_SUB function in MySQL, so