Re: mysql question

From: Date: Thu, 11 Jul 2002 18:47:16 +0000
Subject: Re: mysql question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107209@lists.php.net to get a copy of this message
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" <milesthompson@ns.sympatico.ca> To: "Alexander Ross" <alexross@bleen.net>; <php-general@lists.php.net> 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 >

« previous php.general (#107209) next »