473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Select query between a few hours.

137 100+
Hello guys,
I'm busy writing a website for dj's.
But i wanted to show the picture and more stuff of the dj who's playing music between a few hours.
Let's say he works between 18:00 and 21:00 on wednesday.
I created a table begin_time and a table end_time and day.
Then i wanted to compare the times with the local time like[PHP]$time = date("H");[/PHP]
[PHP]$day = date("l");[/PHP].
I thought something like this query:

[PHP]$query = "SELECT * FROM dj WHERE day='{$day}' AND begin_time='{$time}'=BETWEEN begin_time AND end_time";[/PHP].

But i can't figure it out....
The problem is that the time only compares at that hour (eg 18:00 and 21:00) but when it is 20:00 he doesn't recognize it.(logical of course...)
But how can i let it work like this...

Thanx in advance!

Paul
May 23 '07 #1
1 3442
pbmods
5,821 Expert 4TB
Hello guys,
I'm busy writing a website for dj's.
But i wanted to show the picture and more stuff of the dj who's playing music between a few hours.
Let's say he works between 18:00 and 21:00 on wednesday.
I created a table begin_time and a table end_time and day.
Then i wanted to compare the times with the local time like[PHP]$time = date("H");[/PHP]
[PHP]$day = date("l");[/PHP].
Take a look at CURDATE() and CURTIME(). You can also use NOW(), which returns a timestamp, so you can use it for both dates and times.
May 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: George | last post by:
Hi, The sql query below returns data in the 'note' field from a table called ww_rec_1 from the previous month and displays the sum of hours for each category. SELECT note,SUM(hours)FROM...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
4
by: Stephen Young | last post by:
Hello Have a bit of a problem, im trying to get the total number of hours:minutes for all actions over the month in a query, have tried two methods to no luck... Duration This Month:...
1
by: davidboyd24 | last post by:
Im currently having difficulty trying to write an SQL query in Access which will add two columns together to calculate a totals column. For example... I was hoping to get the below resultset...
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
30
by: Noob | last post by:
ftp://ukcassassin:winston@www.ukcassassin.pwp.blueyonder.co.uk/htdocs/Diary%20Form.bmp Hi all I will appologise in advance for my lack of knowledge of access and its working as i am quite new to...
7
by: Mike1961 | last post by:
Hi there. Well the situation is this, I have two tables: 1) tbl_registry where rows with code = 123 are 35 ; 1) tbl_Registered where rows with code = 123 are 43 In tbl_Registered I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.