testing for true greater than 1 - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > Perl » testing for true greater than 1


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-07-2006   #1 (permalink)
avery
Junior Member
 
Join Date: Jul 2006
Age: 43
Posts: 5
Default testing for true greater than 1

hi, probably a silly question i've asked before (I blame the heat for memory loss!), but I've been thinking of ways to streamline my code and DB queries.

some of my code tests for the existence of a record by selecting it, I realise that using a count(1) is much more efficient.

I just wanted confirmation that when using the if statement to check for true, if it is given a number > 1 it is still true.

I.E.

if(cntSQL("Table","WHERE")){do whatever}

or should I explicitly write the condition...

if(cntSQL("Table","WHERE") > 0){do whatever}

my cntSQL routine does the following SQL command...

#Build SQL Statement
my $sel = "SELECT COUNT(1) as COUNT FROM $_[0] WHERE $_[1]";

so the count could be from ZERO to the amount records in table, some checks I do just care a record exists regardless of how many.

Thanks
Avery
avery is offline   Reply With Quote


Old 07-23-2006   #2 (permalink)
Ankita
Member
 
Join Date: Jul 2006
Age: 25
Posts: 53
Lightbulb Re: testing for true greater than 1

As far as I know its true for any number other than 0. Let me know If I am wrong!
Ankita is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB 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
true story tychicus Jokes / Humor 2 09-06-2006 07:07 AM
This is a true story vijith Jokes / Humor 2 09-02-2006 07:36 AM
Blogger:How To Show The True Title of A Post diddy1 Blogging 0 08-10-2006 01:40 AM


footer left
All times are GMT. The time now is 12:09 AM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Vienna Austria Hotels | Free vBulletin Skins | McDonalds | Cheap Loan | Online Image Resizer

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49