Solved

data type error

Posted on 2004-05-01
5
131 Views
Last Modified: 2013-12-24
my database useroid is numeric, however the way i setup the cookies and application, a UUID useroid is created! thus i get a useroid mismatch when trying to query the database. could someone tell me how i can fix the cookie to make it numeric as well, below is the code from my application.cfm

<!--- ::      
      * set a default UUID cookie, for demo purposed this is a temp cookie.
      * But is usually a never-expiring cookie.
      *
      * this UUID is also the primary key of the user in the database.
      :: --->
<cfif not isDefined("cookie.petmarketuseroid")>
      <cfcookie name="petmarketuseroid" value="#createuuid()#">
</cfif>


<cfif not isDefined("session.user") or session.user.useroid neq cookie.petmarketuseroid>
      <cfscript>
            session.user = createObject("component", "petmarket.user");
            session.user.init(useroid=cookie.petmarketuseroid);
      </cfscript>
</cfif>
0
Comment
Question by:finnstone
  • 2
5 Comments
 

Author Comment

by:finnstone
ID: 10967332
here is where the code chokes

<!--- ::      
      * populate this objects properties with a single user. creating a single user instance
      *
      * @param      useroid      the only field that is required is the users unique useroid (db primary key)
      :: --->      
      <cffunction name="init" access="public" output="true" returntype="struct" hint="retrieve the users info from the db.">
            <cfargument name="useroid" required="false" type="numeric">
            <cfscript>
                  //place all arguments into "this" scope. - only work with this scope from now on.
                  //this allows for user to call init() 2 ways.
                  //      myObject.useroid = xxxx;
                  //       myObject.init();
                  //      or
                  //      myObject.init( useroid="xxxx" );
                  for( key in arguments )
                        { this[key] = arguments[key]; }
            </cfscript>
      
            <cfquery name="getUser" datasource="#this.db#">
                  select *
                  from userinfo
                  where useroid = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(this.useroid)#">
            </cfquery>
0
 

Author Comment

by:finnstone
ID: 10967378
never mind, i solved it by not requiring a type!
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10978857
Post a message here asking for this question to be PAQ :

http://www.experts-exchange.com/Community_Support/
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 11190576
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now