2 Replies - 4238 Views - Last Post: 02 May 2015 - 07:07 PM Rate Topic: -----

#1 MIGhunter  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 17-January 09

CreateUUID database issues

Posted 02 May 2015 - 02:41 AM

<cfinput  type="hidden"
		name="newActivationcode" 
		value="#CreateUUID()#">


I'm using that to create an ID for user registration. It works and puts fun stuff like
C7690A05-CC24-91E2-6FFC84C660DB36B9

in my mySQL database. However, when I call it later, I get an error from
<!--- Get user Activation code from database --->
<cfquery datasource="ArcheAge" name="Activation">
SELECT ContactID, newActivationcode
FROM kov_contacts
WHERE newActivationcode=#URL.newActivationcode#
</cfquery>


It tells me
Unknown column 'C7690A05' in 'where clause'

Which is the UUID up until the hyphen. If I replace the string of numbers and replace them with something simple like "4" it works fine. What is causing the UUID to fail? How can I fix it? Boggling my mind all night.

Is This A Good Question/Topic? 0
  • +

Replies To: CreateUUID database issues

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 2024
  • View blog
  • Posts: 3,609
  • Joined: 13-January 08

Re: CreateUUID database issues

Posted 02 May 2015 - 06:38 AM

My guess is that it's the URL variable you're passing in to your query. The dashes could be getting converted to their ASCII equivalents and that's why the database call fails.

However, look into the following things. Is the datatype of the column that you're saving the UUID to VARCHAR and is it of sufficient length to hold the entire UUID string? If so, try passing in your URL variable with CFQUERYPARAM (which is a good idea because you should never EVER pass in user supplied variable content to your database without the use of a bind parameter if for no other reason that database security). That might help out some.

Give those a try and let us know how it goes.

Good luck!

This post has been edited by Craig328: 02 May 2015 - 06:39 AM

Was This Post Helpful? 1
  • +
  • -

#3 MIGhunter  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 17-January 09

Re: CreateUUID database issues

Posted 02 May 2015 - 07:07 PM

View PostCraig328, on 02 May 2015 - 06:38 AM, said:

My guess is that it's the URL variable you're passing in to your query. The dashes could be getting converted to their ASCII equivalents and that's why the database call fails.

However, look into the following things. Is the datatype of the column that you're saving the UUID to VARCHAR and is it of sufficient length to hold the entire UUID string? If so, try passing in your URL variable with CFQUERYPARAM (which is a good idea because you should never EVER pass in user supplied variable content to your database without the use of a bind parameter if for no other reason that database security). That might help out some.

Give those a try and let us know how it goes.

Good luck!

That fixed it thanks. I haven't done any coldfusion in a while and totally forgot about the cfqueryparam.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1