Select rows from MySQL table where PHP timestamp is older than X

前端 未结 4 541
逝去的感伤
逝去的感伤 2020-12-17 02:12

I have a user table, where users need to be approved, i want to show users who are not approved and is registered more than 7 days ago.

My user_regdate is a timestam

4条回答
  •  鱼传尺愫
    2020-12-17 02:43

    Primitive solution at best, but im not the best at MySQL time calculation

    $timestamp = strtotime("-7 days");
    mysql_query("SELECT * FROM users WHERE user_regdate < $timestamp AND approved = 0 ORDER BY id");
    

提交回复
热议问题