How about

SELECT * FROM table WHERE $current_shot BETWEEN start_shot AND end_shot

Also, I hope you are validating $current_shot if register globals is on, to
make sure it's really just an integer and not some extra SQL that'll allow
someone to view your entire table/database...

---John Holmes...

----- Original Message -----
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: "Alexander Ross" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, July 11, 2002 12:24 PM
Subject: Re: [PHP] mysql question


> Yes, though I'd probably add parentheses to make it clearer.
>
> select * from table where ((start_shot <= $current_shot) and (end_shot >=
> $current_shot))
>
> Though that's probably not necessary. Make certain you have your less
> than's and greater thans set the right way, I've often sat slack-mouthed
> wondering why I had no data, simply because I was using "<" when it should
> have been ">".
>
> Cheers - Miles Thompson
>
> At 12:06 PM 7/11/2002 -0400, Alexander Ross wrote:
> >I realize this isn't a php question, but I figured that someone here
knows
> >of a good mysql newsgroup and in the mean time someone here probaby knows
> >the answer to my question.
> >
> >Can I set up a query like this:
> >
> >select * from table where start_shot <= $current_shot and end_shot >=
> >$current_shot
> >
> >note everything will be of type INT
> >
> >Thanks ya'll
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to