dimanche 24 mai 2015

select mysql IF in the last 60 minutes email was entered

I am trying to check if the email address has been entered within the last hour. If it has I want to echo some text.

Usage_Date . Usage_Time my date and time are in two different columns.

$db_check_usage_date_time = mysql_query("SELECT * FROM User_Data WHERE Usage_Date.Usage_Time >= date_sub(NOW(), INTERVAL 60 MINUTE)");

    if (mysql_num_rows($db_check_usage_date_time) > 0) {
        echo 'USED IN THE LAST HOUR';
    }else {}

I get the error: mysql_num_rows() expects parameter 1 to be resource, boolean given in

Aucun commentaire:

Enregistrer un commentaire