Solved

data type error

Posted on 2004-05-01
5
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 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