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

  • Home
  • SEARCH
  • 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 9210503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:05:43+00:00 2026-06-18T01:05:43+00:00

EDIT: The query Gordon posted appears to have a problem. If I have a

  • 0

EDIT: The query Gordon posted appears to have a problem. If I have a booking from 10-12 it seems to consider all bookings past 12 pm invalid, but all bookings before 10am valid.

Some quick and simple thinking ended up in me creating the following query:

SELECT serverip 
        FROM   server 
        WHERE  serverip NOT IN (SELECT serverip 
                                FROM   booking 
                                WHERE  startat >= datehere 
                                AND expiresat <= datehere) 
        LIMIT  1; 

Suppose the booking table stores the following:

+-----------+-----------+----------+----------+-----------+
| bookingid | serverip  | username | startat  | expiresat |
+-----------+-----------+----------+----------+-----------+
|         1 | 127.0.0.1 | testuser | 10:00    | 12:00     |
+-----------+-----------+----------+----------+-----------+

If the user was to input the following data for a booking:

startat = 9:59
expiresat = 12:01

They could easily bypass my check to see if the booking time is available based on previous bookings stored.

Any advice on how I could better solve this problem?

I would prefer NOT to limit the users input and would like to avoid hard coding specific time slots, if that wasn’t a problem however I would stick with what I’ve got.

Thanks for your time.

  • 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-18T01:05:44+00:00Added an answer on June 18, 2026 at 1:05 am
    SELECT *
    FROM server
    WHERE serverip NOT IN
    (SELECT serverip 
     FROM booking
     WHERE
       (startat <= '2013-01-30 08:00:00' AND expiresat >= '2013-01-30 08:00:00') OR
       (startat <= '2013-01-30 09:00:00' AND expiresat >= '2013-01-30 09:00:00') OR
       (startat >= '2013-01-30 08:00:00' AND expiresat <= '2013-01-30 09:00:00'))
    

    Where 8:00 is start time and 9:00 is expire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help with a wordpress problem. I need to edit the query.php to ONLY
How can I edit this query to work correctly ? SELECT * FROM my_table
I have following query: SELECT * FROM ( SELECT catalog.*, images.image FROM `catalog` as
I have a oracle query: select * from table1,table2 where table1.id1 = table2.id2 and
I run script/generate model query edit query.rb in models.. class Query < ActiveRecord::Base #I
EDIT: See my answer below--> I am wanting to have a view that when
Edit (updated question) I have a simple C program: // it is not important
I have inherited an Excel spreadsheet which contains an external data query. I can
I'm looking at an execution plan from a troublesome query. I can see that
I want to edit this query =COUNTIFS('Sheet1'!E2:E465,7,'Sheet1'!F2:F465,2) so that when I drag/copy it sideways,

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.