­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ connect_error) { throw new Exception("DB connect error: " . $conn->connect_error); } $stmt = $conn->prepare(" SELECT 1 FROM {$table} WHERE {$colPhone} = ? AND {$colCreated} >= (NOW() - INTERVAL 7 DAY) LIMIT 1 "); $stmt->bind_param("s", $phone); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { echo "1"; // duplicate found } else { echo "0"; // not found } $stmt->close(); $conn->close(); } catch (Exception $e) { // On error, allow submission // error_log($e->getMessage()); echo "0"; } ?>