Solved

data type error

Posted on 2004-05-01
5
137 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

840 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