从电子邮件地址获取用户名/帐户名
客户表包含名字、姓氏、电子邮件和部门。我需要将电子邮件地址的用户名部分(即@之前的所有内容)与会话的用户名进行比较以验证真实性。
我如何构建 cfquery 以将电子邮件地址的所需部分与会话变量 casuser 进行比较?
<cfquery name="getUsername" dsn="myDSN">
select firstname, lastname, email, department, organization, rank
from client
where email= '#casuser#'
</cfquery>
数据库位于使用 CF8 的 SQL Server 2008 上。
谢谢。
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, organization, rank
from client
where email= '#casuser#'
</cfquery>
The database is on SQL Server 2008 using CF8.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
几乎您需要使用 like 语句并比较包括 @ 符号在内的任何内容。所以应该是类似这样的:
Pretty much you need to use like statement and compare anything including @ sign. So should be something similar to this:
Andrey 的方法显然没有任何问题,但如果您不想使用 like...
绝对包含 cfqueryparam
There's obviously nothing wrong with Andrey's approach, but in the event you'd rather not use the like...
Definitely include cfqueryparam