Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 04-24-2004, 05:45 PM   #16 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Ah, ok I see now; you're trying to match only one record, and you know the following 7 records will NOT match the criteria. So the query I've given you should only grab one record, which it does. My bad.

Now the way I see it, we can still use the exact same method, and tweak the query slightly so it will grab the one that matches plus the next 7. Based on what I can understand (and I think I've got it now), the 'next 7' records you want to retrieve are solely those events that take place after the single event you need to match. So we can safely assume that any record that has a start_time greater than the time you've provided in the WHERE clause will be one you want, i.e. they will be events that take place immediately after that one. Correct?

With this in mind, change the query I've given you to this instead:
PHP Code:
$query = <<< END
  SELECT *
  FROM 
{$today}
  WHERE 
{$timestamp} BETWEEN start_time AND end_time
  OR 
{$timestamp} < start_time
  LIMIT 8
END; 
Now that should work.

Obviously change the '*' to the select only the fields you want; I've kept my example short and am selecting every column for the sake of brevity.
bdl is offline   Reply With Quote
Old 04-24-2004, 06:27 PM   #17 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 124
metazai is on a distinguished road
Spiffy . . . that should fix my problem for now. And I learned something too! Kind of like an afterschool special.

=+)
metazai is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB Design Question Part II sde Program Design and Methods 10 09-02-2008 11:37 AM
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM
Dynamic Arrays, the 'right' way. Mr.Anderson Standard C, C++ 10 10-05-2004 06:00 AM
another question Ilya020 HTML, XML, Javascript, AJAX 5 08-20-2003 11:54 AM
Database Design Question sde Program Design and Methods 7 04-25-2003 05:55 PM


All times are GMT -8. The time now is 11:46 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting