Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8474595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:40:14+00:00 2026-06-10T17:40:14+00:00

How would you go about selecting records timestamped within a certain amount of time

  • 0

How would you go about selecting records timestamped within a certain amount of time of each other?

Application and sought solution:

I have a table with records of clicks, I am wanting to go through and find the clicks from the same IP that occurred within a certain time period.

e.g.: SELECT ALL ip_address WHERE 5 or more of the same ip_address, occurred/are grouped within/timestamped, within 10 minutes of each other

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:40:16+00:00Added an answer on June 10, 2026 at 5:40 pm

    Decided not to try for a single query on the raw data.

    After discussion with a friend, and then reading about options mentioning the memory engine, and PHP memcatche; I decided to go with a regular table to record click counts that use a time to live timestamp. After that timestamp is passed, a new ttl is assigned and the count is re-set.
    One thing is for my application I can’t be exactly sure how long the parameter configuration settings will be – if they are larger and the memory gets cleared, then things start over.

    It isn’t a perfect solution if it is run on user link click, but it should be pretty good about catching click fraud storms, and do the job.

    Some managing PHP/MySQL code (“Drupalized queries”):

    $timeLimit = $clickQualityConfigs['edit-submitted-within-x-num-of-same-ip-clicks']." ".$clickQualityConfigs['edit-submitted-time-period-same-ip-ban']; // => 1 days // e.g.
    $filterEndTime = strtotime("+".$timeLimit);
    
    $timeLimitUpdate_results = db_query('UPDATE {ip_address_count} 
    SET ttl_time_stamp = :filterendtime, click_count = :clickcountfirst WHERE ttl_time_stamp < :timenow', array(':filterendtime' => $filterEndTime, ':clickcountfirst' => '0', ':timenow' => time()));
    
    $clickCountUpdate_results = db_query('INSERT INTO {ip_address_count} (ip_address,ttl_time_stamp,click_count) 
    VALUES (:ipaddress,:timestamp,:clickcountfirst) 
    ON DUPLICATE KEY UPDATE click_count = click_count + 1', array(':ipaddress' => $ip_address,':timestamp' => $filterEndTime,':clickcountfirst' => '1'));
    

    DB info:

    CREATE TABLE `ip_address_count` (
       `ip_address` varchar(24) NOT NULL DEFAULT '',
       `ttl_time_stamp` int(11) DEFAULT NULL,
        `click_count` int(11) DEFAULT NULL,
     PRIMARY KEY (`ip_address`)
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering how i would go about making the following application: a user signs
Anyone have any idea how I would go about converting a timestamp in milliseconds
I am wondering how I would go about performing a certain function if a
I have a basic question about selecting counts: If I have a table ContentTable
Using ASP.Net MVC3 with C# How would I go about selecting a single random
How would I go about selecting only the week number in this h3 and
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
Any ideas how I would go about writing a javascript method to insert an
Just a quick question about how you would go about implementing this. I want
I would like to know how I would go about altering the HTML that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.