Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer

On Wed, Jan 26, 2011 at 12:30 PM, Ezra Parker  wrote:
>
> On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer
>  wrote:
>> 
>
> Unless I'm missing something, this should be:
>
> 

Y'know, I'd bring up the fact that I've been working in script much
more than tags lately... but "=" *still* wouldn't be the correct
operator.

*sigh* :)

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341433
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Ezra Parker

On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer
 wrote:
> 

Unless I'm missing something, this should be:



--
Ezra Parker

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341430
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Matt Quackenbush

One last note.  You need to var scope your query.





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341429
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Dave Watts

> Gotta say thats a first and I have been doing mssql for ten years.  I am 
> telling you this is what is causing his error because tsql is not as flexible
> as you think because its procedural and requires you do it in a certain way.

This is incorrect. Literal values can be placed on either side of the
comparison operator in T-SQL. In older versions of MS SQL Server, it
was recommended to put the field first in the expression because the
query analyzer would use indexes, but I suspect that's no longer true.
In any case, you could do it even in old versions of SQL Server - 6.5,
for example.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341425
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer

d'oH!  Good catch.

So if you go the implicit boolean conversion route, switch the "return
true" for "return false"...

On Wed, Jan 26, 2011 at 12:06 PM, Scott Stroz  wrote:
>
> Actually, these will not return the same value.
>
> Lets assume the query returns 0 records.
>
>  will return true
>
>  will return false
>
>
> On Wed, Jan 26, 2011 at 1:43 PM, Charlie Griefer
>  wrote:
>>
>> On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg  wrote:
>>>
>>> I solved it with the first couple of posts help.
>>>
>>>      
>>>          
>>>      
>>>          
>>>      
>>
>> Glad you got it working.
>>
>> You can tighten that return up a bit by doing:
>>
>> 
>>
>> Then no need for the conditional.
>>
>> You could also drop the comparison itself since CF does implicit
>> boolean conversion.
>>
>> 
>>
>> ^That'll do the same thing.
>>
>> --
>> Charlie Griefer
>> http://charlie.griefer.com/
>>
>> I have failed as much as I have succeeded. But I love my life. I love
>> my wife. And I wish you
>>
>>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341423
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Scott Stroz

Let me correct that.

 will return true

but

 will evaluate to false

On Wed, Jan 26, 2011 at 2:06 PM, Scott Stroz  wrote:
> Actually, these will not return the same value.
>
> Lets assume the query returns 0 records.
>
>  will return true
>
>  will return false
>
>
> On Wed, Jan 26, 2011 at 1:43 PM, Charlie Griefer
>  wrote:
>>
>> On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg  wrote:
>>>
>>> I solved it with the first couple of posts help.
>>>
>>>      
>>>          
>>>      
>>>          
>>>      
>>
>> Glad you got it working.
>>
>> You can tighten that return up a bit by doing:
>>
>> 
>>
>> Then no need for the conditional.
>>
>> You could also drop the comparison itself since CF does implicit
>> boolean conversion.
>>
>> 
>>
>> ^That'll do the same thing.
>>
>> --
>> Charlie Griefer
>> http://charlie.griefer.com/
>>
>> I have failed as much as I have succeeded. But I love my life. I love
>> my wife. And I wish you
>>
>> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341422
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer

Well, it will return the actual recordcount... which is a number.  But
CF implicitly converts numeric values to boolean values. Any non-zero
value is true, while any zero value is false.

So given the following code:

do something

... assuming myMethod returns a numeric value, your page will output
"do something" as long as the value returned is not zero.

On Wed, Jan 26, 2011 at 12:02 PM, Che Vilnonis  wrote:
>
> Charlie, is this true only when the return type is "Boolean"?
> Otherwise, it should return the actual recordcount, right?
>
> Thanks, Che
>
>
>
>
> You could also drop the comparison itself since CF does implicit boolean
> conversion.
>
> 
>
> ^That'll do the same thing.
>
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341419
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Scott Stroz

Actually, these will not return the same value.

Lets assume the query returns 0 records.

 will return true

 will return false


On Wed, Jan 26, 2011 at 1:43 PM, Charlie Griefer
 wrote:
>
> On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg  wrote:
>>
>> I solved it with the first couple of posts help.
>>
>>      
>>          
>>      
>>          
>>      
>
> Glad you got it working.
>
> You can tighten that return up a bit by doing:
>
> 
>
> Then no need for the conditional.
>
> You could also drop the comparison itself since CF does implicit
> boolean conversion.
>
> 
>
> ^That'll do the same thing.
>
> --
> Charlie Griefer
> http://charlie.griefer.com/
>
> I have failed as much as I have succeeded. But I love my life. I love
> my wife. And I wish you
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341418
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Che Vilnonis

Charlie, is this true only when the return type is "Boolean"?
Otherwise, it should return the actual recordcount, right?

Thanks, Che




You could also drop the comparison itself since CF does implicit boolean
conversion.



^That'll do the same thing.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341415
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Kelly

This is true.  I've done it and it works. It's easy enough to test and 
see that Alan is correct.


On 1/26/2011 1:57 PM, Alan Rother wrote:
> I don't know what to tell you Mike, SQL Server doesn't care, it works either
> way
>
> SELECT *
> FROM PropImage
> WHERE
> 20 = PropertyID works exactly the same as PropertyID = 20
>
> It's just common convention that we use PropertyID = 20
>
> In the internal SQL engine it's just running a logical comparison against
> the statement itself. SQL Server is pretty darn intelligent.
>
> Try it.
>
>
> Now all that being said, I still wouldn't recommend doing things that way,
> but it does work.
>
>
>
> On Wed, Jan 26, 2011 at 11:27 AM, Michael Firthwrote:
>
>> Alan wrote:
>>
>> MSSQL doesn't care if the field is on the left or the right, it's just
>> running a comparison against the statement.
>>
>> Gotta say thats a first and I have been doing mssql for ten years.  I am
>> telling you this is what is causing his error because tsql is not as
>> flexible as you think because its procedural and requires you do it in a
>> certain way.
>>
>> Mike
>>
>> On Jan 26, 2011, at 1:23 PM, Alan Rother wrote:
>>
>>> MSSQL doesn't care if the field is on the left or the right, it's just
>>> running a comparison against the statement.
>>
>>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341412
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Alan Rother

I don't know what to tell you Mike, SQL Server doesn't care, it works either
way

SELECT *
FROM PropImage
WHERE
   20 = PropertyID works exactly the same as PropertyID = 20

It's just common convention that we use PropertyID = 20

In the internal SQL engine it's just running a logical comparison against
the statement itself. SQL Server is pretty darn intelligent.

Try it.


Now all that being said, I still wouldn't recommend doing things that way,
but it does work.



On Wed, Jan 26, 2011 at 11:27 AM, Michael Firth wrote:

>
> Alan wrote:
>
> MSSQL doesn't care if the field is on the left or the right, it's just
> running a comparison against the statement.
>
> Gotta say thats a first and I have been doing mssql for ten years.  I am
> telling you this is what is causing his error because tsql is not as
> flexible as you think because its procedural and requires you do it in a
> certain way.
>
> Mike
>
> On Jan 26, 2011, at 1:23 PM, Alan Rother wrote:
>
> > MSSQL doesn't care if the field is on the left or the right, it's just
> > running a comparison against the statement.
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341411
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer

On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg  wrote:
>
> I solved it with the first couple of posts help.
>
>      
>          
>      
>          
>      

Glad you got it working.

You can tighten that return up a bit by doing:



Then no need for the conditional.

You could also drop the comparison itself since CF does implicit
boolean conversion.



^That'll do the same thing.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341402
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Kelly

Awesome! :)

On 1/26/2011 1:31 PM, Adam Bourg wrote:
> I solved it with the first couple of posts help.
>
> New code:
>
>  
>
>   
>   SELECT
>   profileID
>  FROM
>   mod_userStatus
>   WHERE
>   profileID = #Session.Profile.profileID#
>  
>
>
>
>
>
>
>
>
>  
>
> That returns true or false. Then I invoke the method, return a variable and 
> do a CF control structure and works no problem now.
>
> Thanks for the help.
>
> Adam
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341400
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Adam Bourg

I solved it with the first couple of posts help. 

New code: 




SELECT
profileID
FROM
mod_userStatus
WHERE
profileID = #Session.Profile.profileID#


   
 
 
 
   
  



That returns true or false. Then I invoke the method, return a variable and do 
a CF control structure and works no problem now. 

Thanks for the help. 

Adam 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341399
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Michael Firth

Alan wrote:

MSSQL doesn't care if the field is on the left or the right, it's just
running a comparison against the statement.

Gotta say thats a first and I have been doing mssql for ten years.  I am 
telling you this is what is causing his error because tsql is not as flexible 
as you think because its procedural and requires you do it in a certain way.

Mike

On Jan 26, 2011, at 1:23 PM, Alan Rother wrote:

> MSSQL doesn't care if the field is on the left or the right, it's just
> running a comparison against the statement.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341397
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Alan Rother

>>>Kelly is right with the cftry and cfcatch.  If you change your query like
this it should correct your bug I am thinking because when you write a query
the database field has to be on the left.  TSQL doesnt know what a session
variable is.

MSSQL doesn't care if the field is on the left or the right, it's just
running a comparison against the statement.

It also has no idea that it was a session variable, by the time it gets to
the SQL Server, ColdFusion has parsed it out into a SQL string, and that's
all that gets passed into the database.
-- 
Alan Rother
Manager, Phoenix Cold Fusion User Group, www.AZCFUG.org
Twitter: @AlanRother


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341395
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Charlie Griefer

Got a few questions about your CFC method...

1) where is the variable DSN coming from?
2) Should your WHERE be: WHERE profileID = #session.profile.profileID#
? (essentially the reverse of what you have)
3) consider using  in your SQL when using dynamic values
(yeah, I know... that's not a question)
4) along those same lines, you should var scope your query name.
, and then run the cfquery.  It
may or may not be a big deal for this particular method... but in
general, you want to var scope any variable used in a method.  This
ensures that the variable is bound to that method and that method
only.
5) you're running the query, but returning true regardless of the
result of the query.  Should there perhaps be a conditional in there?
6) As Michael F. suggested, you might want to pass the profileID
variable in as an argument to the method.  It's generally considered
to be bad practice to reference session (or any outside scope) from
within a cfc method, as that breaks encapsulation (meaning the method
should only know about itself... nothing about the 'outside world'...
anything it needs to know should be sent in to it... think "black
box").
7) To see what the query is returning, you can always do a  right after the  and
above the 

On Wed, Jan 26, 2011 at 10:47 AM, Adam Bourg  wrote:
>
> Here's what I'm trying to do. I'm building a module that only our 
> Professional Staff can access, I am trying to identify where the person 
> logged in is a pro staff member or a student staffer. When they log into our 
> CMS, there is a session variable that returns their profile id. it is: 
> #Session.Profile.profileID#
>
> We have two tables:
> Table 1: pro_profile
> Primary key: profileID
> This contains all users, their information etc...
>
> Table 2: mod_userStatus
> Primary key:
> Sec Key: profileID
> This is simply a primary key with a secondary key of profileID. If a person 
> is on this list they are a prostaffer, if not they are a student.
>
> I'm trying to query the database and return boolean if the user exists on 
> mod_userStatus. If yes, they can access the page, if no, redirect.
>
> Here's the CFC.
>
>    
>        
>                SELECT
>                profileID
>            FROM
>                mod_userStatus
>                WHERE
>                #Session.Profile.profileID# = profileID
>        
>
>      
>    
>
> When I run this, it just gives me a blank page, returns nothing and no error.
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341393
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Return boolean from a CFC query

2011-01-26 Thread Russ Michaels

Sorry if I am repeating what anyone else has said, I didn't read the rest of
the thread.

If you catch errors inside the CFC using try/catch you can then return then
in your return struct to inform your calling page that there was an error.

e.g.



 Call your error handler, or do a CFTHROW to cause the default error handler
to be used.


It is a good idea to then have a template or a cfc that handles your error,
outputs a friendly message, logs the error and sends you an email.

Frameworks like ColdSpring will handle a lot of this stuff for you if you
want to get into that.



--
Russ Michaels

www.bluethunderinternet.com: Business hosting services & solutions
www.cfmldeveloper.com  : ColdFusion community and developer
hosting
www.michaels.me.uk : My Blog 
www.cfsearch.com   : ColdFusion search engine 
skype me   : russmichaels




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341392
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Michael Firth

Kelly is right with the cftry and cfcatch.  If you change your query like this 
it should correct your bug I am thinking because when you write a query the 
database field has to be on the left.  TSQL doesnt know what a session variable 
is.

>> 
>>  SELECT
>>  profileID
>>FROM
>>  mod_userStatus
>>  WHERE
>>  profileID = #Session.Profile.profileID# 
>>

I wonder why ColdFusion does that never really knew why.  Perhaps one of the 
senior guys can answer that one.

Thanks,

Mike

On Jan 26, 2011, at 1:12 PM, Kelly wrote:

> 
> Yep this is true - a cftry/cfcatch helps or just run the query outside 
> of the cfc to see if it's throwing an error.
> 
> On 1/26/2011 1:03 PM, Michael Firth wrote:
>> I also want to add when you run a cfc page with a query sometimes when you 
>> get an error a blank page will occur without any error information.
>> 
>> 
>> On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:
>> 
>>> Here's what I'm trying to do. I'm building a module that only our 
>>> Professional Staff can access, I am trying to identify where the person 
>>> logged in is a pro staff member or a student staffer. When they log into 
>>> our CMS, there is a session variable that returns their profile id. it is: 
>>> #Session.Profile.profileID#
>>> 
>>> We have two tables:
>>> Table 1: pro_profile
>>> Primary key: profileID
>>> This contains all users, their information etc...
>>> 
>>> Table 2: mod_userStatus
>>> Primary key:
>>> Sec Key: profileID
>>> This is simply a primary key with a secondary key of profileID. If a person 
>>> is on this list they are a prostaffer, if not they are a student.
>>> 
>>> I'm trying to query the database and return boolean if the user exists on 
>>> mod_userStatus. If yes, they can access the page, if no, redirect.
>>> 
>>> Here's the CFC.
>>> 
>>>
>>> 
>>> SELECT
>>> profileID
>>>FROM
>>> mod_userStatus
>>> WHERE
>>> #Session.Profile.profileID# = profileID
>>>
>>> 
>>>  
>>>
>>> 
>>> When I run this, it just gives me a blank page, returns nothing and no 
>>> error.
>>> 
>>> 
>> 
> 
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341391
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Kelly

Yep this is true - a cftry/cfcatch helps or just run the query outside 
of the cfc to see if it's throwing an error.

On 1/26/2011 1:03 PM, Michael Firth wrote:
> I also want to add when you run a cfc page with a query sometimes when you 
> get an error a blank page will occur without any error information.
>
>
> On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:
>
>> Here's what I'm trying to do. I'm building a module that only our 
>> Professional Staff can access, I am trying to identify where the person 
>> logged in is a pro staff member or a student staffer. When they log into our 
>> CMS, there is a session variable that returns their profile id. it is: 
>> #Session.Profile.profileID#
>>
>> We have two tables:
>> Table 1: pro_profile
>> Primary key: profileID
>> This contains all users, their information etc...
>>
>> Table 2: mod_userStatus
>> Primary key:
>> Sec Key: profileID
>> This is simply a primary key with a secondary key of profileID. If a person 
>> is on this list they are a prostaffer, if not they are a student.
>>
>> I'm trying to query the database and return boolean if the user exists on 
>> mod_userStatus. If yes, they can access the page, if no, redirect.
>>
>> Here's the CFC.
>>
>> 
>>  
>>  SELECT
>>  profileID
>> FROM
>>  mod_userStatus
>>  WHERE
>>  #Session.Profile.profileID# = profileID
>> 
>>
>>   
>> 
>>
>> When I run this, it just gives me a blank page, returns nothing and no error.
>>
>>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341390
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Michael Firth

I also want to add when you run a cfc page with a query sometimes when you get 
an error a blank page will occur without any error information.


On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:

> 
> Here's what I'm trying to do. I'm building a module that only our 
> Professional Staff can access, I am trying to identify where the person 
> logged in is a pro staff member or a student staffer. When they log into our 
> CMS, there is a session variable that returns their profile id. it is: 
> #Session.Profile.profileID#
> 
> We have two tables: 
> Table 1: pro_profile
> Primary key: profileID
> This contains all users, their information etc... 
> 
> Table 2: mod_userStatus
> Primary key: 
> Sec Key: profileID
> This is simply a primary key with a secondary key of profileID. If a person 
> is on this list they are a prostaffer, if not they are a student.
> 
> I'm trying to query the database and return boolean if the user exists on 
> mod_userStatus. If yes, they can access the page, if no, redirect. 
> 
> Here's the CFC. 
> 
>
>   
>   SELECT
>   profileID
>FROM
>   mod_userStatus
>   WHERE
>   #Session.Profile.profileID# = profileID
>
> 
>
>
> 
> When I run this, it just gives me a blank page, returns nothing and no error. 
> 
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341389
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Kelly

So the query comes back with no results if it's a student?  Why not do 
something like?



   



   



On 1/26/2011 12:47 PM, Adam Bourg wrote:
> Here's what I'm trying to do. I'm building a module that only our 
> Professional Staff can access, I am trying to identify where the person 
> logged in is a pro staff member or a student staffer. When they log into our 
> CMS, there is a session variable that returns their profile id. it is: 
> #Session.Profile.profileID#
>
> We have two tables:
> Table 1: pro_profile
> Primary key: profileID
> This contains all users, their information etc...
>
> Table 2: mod_userStatus
> Primary key:
> Sec Key: profileID
> This is simply a primary key with a secondary key of profileID. If a person 
> is on this list they are a prostaffer, if not they are a student.
>
> I'm trying to query the database and return boolean if the user exists on 
> mod_userStatus. If yes, they can access the page, if no, redirect.
>
> Here's the CFC.
>
>  
>   
>   SELECT
>   profileID
>  FROM
>   mod_userStatus
>   WHERE
>   #Session.Profile.profileID# = profileID
>  
>
>
>  
>
> When I run this, it just gives me a blank page, returns nothing and no error.
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341388
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Return boolean from a CFC query

2011-01-26 Thread Michael Firth

Switch the following line in your query

profileID = #Session.Profile.profileID#

Also, you may want to consider transferring the session into a local variable 
to be more flexible with your function call

Mike
On Jan 26, 2011, at 12:47 PM, Adam Bourg wrote:

> 
> Here's what I'm trying to do. I'm building a module that only our 
> Professional Staff can access, I am trying to identify where the person 
> logged in is a pro staff member or a student staffer. When they log into our 
> CMS, there is a session variable that returns their profile id. it is: 
> #Session.Profile.profileID#
> 
> We have two tables: 
> Table 1: pro_profile
> Primary key: profileID
> This contains all users, their information etc... 
> 
> Table 2: mod_userStatus
> Primary key: 
> Sec Key: profileID
> This is simply a primary key with a secondary key of profileID. If a person 
> is on this list they are a prostaffer, if not they are a student.
> 
> I'm trying to query the database and return boolean if the user exists on 
> mod_userStatus. If yes, they can access the page, if no, redirect. 
> 
> Here's the CFC. 
> 
>
>   
>   SELECT
>   profileID
>FROM
>   mod_userStatus
>   WHERE
>   #Session.Profile.profileID# = profileID
>
> 
>
>
> 
> When I run this, it just gives me a blank page, returns nothing and no error. 
> 
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341387
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Return boolean from a CFC query

2011-01-26 Thread Adam Bourg

Here's what I'm trying to do. I'm building a module that only our Professional 
Staff can access, I am trying to identify where the person logged in is a pro 
staff member or a student staffer. When they log into our CMS, there is a 
session variable that returns their profile id. it is: 
#Session.Profile.profileID#

We have two tables: 
Table 1: pro_profile
Primary key: profileID
This contains all users, their information etc... 

Table 2: mod_userStatus
Primary key: 
Sec Key: profileID
This is simply a primary key with a secondary key of profileID. If a person is 
on this list they are a prostaffer, if not they are a student.

I'm trying to query the database and return boolean if the user exists on 
mod_userStatus. If yes, they can access the page, if no, redirect. 

Here's the CFC. 



SELECT
profileID
FROM
mod_userStatus
WHERE
#Session.Profile.profileID# = profileID





When I run this, it just gives me a blank page, returns nothing and no error. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341385
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm