Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Welcome to user #UserName#

Status
Not open for further replies.

potinenip

Programmer
Jul 12, 2000
35
US
Hi all,<br>I am trying to create a welcome screen after the user signs in.<br>I am trying to say &quot; welcome to #UserName#&nbsp;&nbsp;&quot;.<br>And it is giving this error.<br>Hope someone can help me on this.<br>Thanks in advance<br>Praveen<br><br>My code is:<br>&lt;CFQUERY NAME=&quot;GetSeller&quot; DATASOURCE=&quot;PostYourHome&quot;&gt;<br> Select * from Sellers where UserName ='#UserName#' <br>&lt;/CFQUERY&gt;<br>&nbsp;<br>&nbsp;&lt;cfoutput&gt; #Seller.SellerFirstName# Welcome back to another session. &lt;/cfoutput&gt;<br><br><br><br>Error is:<br>An error occurred while evaluating the expression: <br>#UserName#<br>Error near line 10, column 43.<br>Error resolving parameter USERNAME<br>ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either: <br>You have misspelled the parameter name, or <br>You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.<br><br>The error occurred while processing an element with a general identifier of (#UserName#), occupying document position (10:42) to (10:51).<br><br><br>
 
Your code references to #Seller.SellerFirstName# but your SQL statement refers to the table Sellers.&nbsp;&nbsp;It should've given you a &quot;Table Does Not Exist Error,&quot; but still, this is the problem.<br><br>It should look like #Sellers.SellerFirstName# or change your SQL to parse the correct table.
 
Hi Praveen,<br><br>You can <br>1. check from where you get the value for the variable #UserName# <br>2. check whether the value is not changed in the middle or<br>3. the variable is available till you use it.<br><br>The above may be of help to you.<br><br>Sriram K
 
Thanks to everybody,<br>Displaying the username is working now.<br>But i have another problem.<br>I want to carry the Username to next pages and use it in all the pages on my application.<br>I have used client variables and all that, but still it wouldn't work. I also set up a database for client variables too using CF administrator.<br>I tried like this:<br><br>&lt;CFAPPLICATION NAME=&quot;MyHouse&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLIENTMANAGEMENT=&quot;Yes&quot;<br> &nbsp;&nbsp;&nbsp;SESSIONMANAGEMENT=&quot;Yes&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SESSIONTIMEOUT=&quot;#CreateTimeSpan(0,0,20,0)#&quot;<br> &nbsp;&nbsp;&nbsp;SETCLIENTCOOKIES=&quot;No&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLIENTSTORAGE=&quot;Client&quot;<br> &nbsp;&nbsp;&nbsp;APPLICATIONTIMEOUT=&quot;#CreateTimeSpan(1,0,0,0)#&quot;&gt;<br>&lt;CFSET dsn = &quot;PostYourHome&quot;&gt;<br><br>&lt;!--- By default, the user is not logged in ---&gt;<br>&lt;CFPARAM NAME=&quot;Client.LoggedIn&quot; DEFAULT=&quot;No&quot;&gt;<br><br>&lt;CFPARAM NAME=&quot;session.User&quot; DEFAULT=&quot;Potineni&quot;&gt; &nbsp;&nbsp;&nbsp;<br>&lt;!--- Check to see if the session variable exists, if not set it. ---&gt;<br>&lt;!--- Check to see if the session variable exists, if not redirect them to the login page<br>&lt;CFPARAM name=&quot;session.IsLoggedIn&quot; default=&quot;N&quot;&gt; ---&gt;<br><br>&lt;CFIF IsDefined(&quot;session.IsLoggedIn&quot;) EQUAL &quot;N&quot;&gt;<br>&nbsp;&nbsp;&lt;cflocation url=&quot;index.cfm&quot;&gt;<br>&lt;/cfif&gt;<br><br><br>And in my loginpage which is action for index page, i wrote :<br><br>&lt;CFPARAM NAME=&quot;Client.UserName&quot;&gt;<br>&lt;CFSET Client.UserName=#UserName#&gt;<br>&lt;CFOUTPUT&gt;#Client.UserName# &lt;/CFOUTPUT&gt;<br><br>I don't know where i'm going wrong. I have to figure this at the earliest.<br><br>I want to basically use the username to retrive and edit the home ads posted by user in HOME_EDIT.cfm page.<br>When i use the query and write this query it wouldn't work.<br><br>&lt;CFQUERY NAME=&quot;EditHouse&quot; DATASOURCE=&quot;PostYourHome&quot;&gt;<br>SELECT * <br>FROM HomesOrLands<br>Where UserName=#Client.UserName#<br>&lt;/CFQUERY&gt;<br><br><br>Please suggest me where i'm wrong.<br>Thanks<br>Praveen
 
try using a simple &lt;cfapplication&gt; tag.&nbsp;&nbsp;Such as:<br><br>&lt;cfapplication Name=&quot;session&quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sessionmanagement=&quot;Yes&quot; &nbsp;&nbsp;&nbsp;Clientmanagement=&quot;Yes&quot;&gt;<br><br>I think that the problem might be in that fact that you are not allowing cookies to be made.&nbsp;&nbsp;As for the time outs (as you seem to be a new user of CFML, dont worry about setting your timeouts in the application as of yet.&nbsp;&nbsp;Take care of that inside the admin section of CF.<br><br>But try taking out the line in your cfapplication tag that is not allowing cookies.
 
Thanks celley,<br>I had already figured that before reading ur reply. But still i got the exact reply i wanted. <br>Thanks<br>Praveen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top