Solved

data type error

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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