开发者

Get username/account name from email address

开发者 https://www.devze.com 2023-03-30 16:37 出处:网络
Client table contains first name, last name, email, and department.I need to compare the username portion of the email address (that is, everything before @) to the session\'s username to verify authe

Client table contains first name, last name, email, and department. I need to compare the username portion of the email address (that is, everything before @) to the session's username to verify authenticity.

How may I structure my cfquery to compare the desire portion of the email address to the session variable casuser?

<cfquery name="getUsername" dsn="myDSN">    
select firstname, lastname, email, department, organiz开发者_StackOverflowation, rank
            from client
            where email= '#casuser#'
</cfquery>

The database is on SQL Server 2008 using CF8.

Thanks.


Pretty much you need to use like statement and compare anything including @ sign. So should be something similar to this:

select firstname, lastname, email, department, organization, rank             
from client             
where email like '#casuser#@%'


There's obviously nothing wrong with Andrey's approach, but in the event you'd rather not use the like...

email = getToken(casUser,1,"@");

Definitely include cfqueryparam

0

精彩评论

暂无评论...
验证码 换一张
取 消