Solved

data type error

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

Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

Question has a verified solution.

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

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…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

624 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