Registration Page problem

Need help with a registration action page.

Page 1 of 1

3 Replies - 2925 Views - Last Post: 11 August 2006 - 07:03 AM Rate Topic: -----

#1 genius3e8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-August 06

Registration Page problem

Posted 10 August 2006 - 04:32 PM

Hi, I just need some help figuring out what the problem is with my registration action page becuase the registration form page seems to be fine. Here is the code for the entire page.

<cfquery name="getId" datasource="jckelly2006">
SELECT max(UserNames.UserID) AS maxID
FROM UserNames
</cfquery>

<cfset newID = (#getID.maxID# + 1)>

<cfquery name="addUser" datasource="jckelly2006">
INSERT INTO UserNames(UserID, UserName, Password, PrivilegeLevel, fk_ActiveID) 
VALUES (#newID#, '#form.userName#', '#form.password#', 1, 1)
</cfquery>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Deity Tracker's Registration Page</title>
  <link rel="stylesheet" href="print.css" type="text/css" media="print" />
  <link rel="stylesheet" href="final.css" type="text/css" media="screen" />
</head>
  <body>
	<cfinclude template="navLinks.cfm">

  <div id="center">
	<p class="textLeft">
	  Welcome to the Deity Tracker Community <strong><cfoutput>#form.UserName#</cfoutput></strong>.<br />
	  You now have searching privileges.<br />
	  Please test your <a href="loginForm.cfm">Log-in</a> now.
	</p>	
	<cfinclude template="contactTemp.cfm">
  </div>

  <div id="right">	
	<cfinclude template="generalLinks.cfm">	
	<p class="linkHead"></p>
  </div>

  </body>
</html>


The error I get is "syntax error in insert into statement" with the Values line highlighted. A link to the actual page to register is http://msit.bloomu.e...addUserForm.cfm which then takes you to http://msit.bloomu.e...dUserAction.cfm after you have entered in both a username and a password and hit register. I have already checked to make sure that the variables with the cfset works.

In case you want the code for the form page, here it is:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Deity Tracker's Registration Page</title>
  <link rel="stylesheet" href="print.css" type="text/css" media="print" />
  <link rel="stylesheet" href="final.css" type="text/css" media="screen" />
</head>
  <body>
	<cfinclude template="navLinks.cfm">

  <div id="center">
	<div class="textCenter">
	  <cfif isdefined("url.message")>
	  <h2>Sorry, you were logged out for your own protection.</h2>
	  </cfif>
	  <form method="post" action="addUserAction.cfm" name="register">
		<p>Please enter your user name: 
		  <input type="text" name="userName">
		</p>
		
		<p>Please enter your password: 
		  <input type="password" name="password">
		</p>
		
		<p><input name="submit" type="submit" value="Register" />
		</p>
	  </form>
	</div>

	<cfinclude template="contactTemp.cfm">
  </div>

  <div id="right">	
	<cfinclude template="generalLinks.cfm">	
	<p class="linkHead"></p>
  </div>

  </body>
</html>


Thanks for any help.

Is This A Good Question/Topic? 0
  • +

Replies To: Registration Page problem

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Registration Page problem

Posted 10 August 2006 - 05:56 PM

What are the data types on your table for each field.

Also, try putting a space between Usernames and the paren:

<cfquery name="addUser" datasource="jckelly2006">
INSERT INTO UserNames (UserID, UserName, Password, PrivilegeLevel, fk_ActiveID)
VALUES (#newID#, '#form.userName#', '#form.password#', 1, 1)
</cfquery>


I don't remember, but username and/or password may be reserved keywords as well. Is UserID a auto-increment primary key?
Was This Post Helpful? 0
  • +
  • -

#3 genius3e8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-August 06

Re: Registration Page problem

Posted 10 August 2006 - 10:45 PM

View Postskyhawk133, on 10 Aug, 2006 - 05:56 PM, said:

What are the data types on your table for each field.

Also, try putting a space between Usernames and the paren:

<cfquery name="addUser" datasource="jckelly2006">
INSERT INTO UserNames (UserID, UserName, Password, PrivilegeLevel, fk_ActiveID)
VALUES (#newID#, '#form.userName#', '#form.password#', 1, 1)
</cfquery>


I don't remember, but username and/or password may be reserved keywords as well. Is UserID a auto-increment primary key?


Thank you so much. It works now. I did not realize that those were reserved words. I had a class on coldFusion about a month ago and the professor said that he thought that it would be all right to use them as column names, but he also said that he had never actually tried it. I am glad I joined this site.

This post has been edited by genius3e8: 10 August 2006 - 10:45 PM

Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Registration Page problem

Posted 11 August 2006 - 07:03 AM

You're welcome, and we're glad you joined! See you around the forums!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1