View Single Post
Old 11-03-2011, 10:49 AM   PM User | #1
chrisfusion
New to the CF scene

 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
chrisfusion is an unknown quantity at this point
access database data insertion

I am currently trying to teach myself coldfusion and am having an issue getting the data to transfer through. any help would be appreciated.

none of the data goes through, but the database shows a null insertion.

Quote:
<cfparam name="userFirst" default="">
<cfparam name="userLast" default="">
<cfparam name="userName" default="">
<cfparam name="userPWD" default="">
<cfparam name="userEmail" default="">
<cfparam name="WarningBit" default="0">
<cfparam name="Mode" default="view">

<cfif Mode is "Submit">
<cfif userFirst is ""><cfset WarningBit=1><cfset firstError="yes"></cfif>
<cfif userLast is ""><cfset WarningBit=1><cfset lastError="yes"></cfif>
<cfif userName is ""><cfset warningBit=1><cfset nameError="yes"></cfif>
<cfif userPWD is ""><cfset WarningBit=1><cfset pwdError="yes"></cfif>
<cfif userEmail is ""><cfset WarningBit=1><cfset emailError="yes"></cfif>

<cfif WarningBit is 0>
<cfif find(" ", userEmail) GT 0><cfset WarningBit=1><cfset emailError="yes"></cfif>
<cfif find("@", userEmail) is 0><cfset WarningBit=1><cfset emailError="yes"></cfif>
<cfif find(".", userEmail) is 0><cfset WarningBit=1><cfset emailError="yes"></cfif>
</cfif>
</cfif>

<cfquery name="RegisterUser" datasource="fusion">
INSERT INTO Users(userName, userPWD, userEmail, userFirst, userLast)
SELECT <cfif userName is not "">'#userName#'<cfelse>NULL</cfif>,
<cfif userPWD is not "">'#userPWD#'<cfelse>NULL</cfif>,
<cfif userFirst is not "">'#userFirst#'<cfelse>NULL</cfif>,
<cfif userLast is not "">'#userLast#'<cfelse>NULL</cfif>,
<cfif userEmail is not "">'#userEmail#'<cfelse>NULL</cfif>
</cfquery>
<html>
<br /><br /><br /><br /><br /><br />
<div align="center">
<head align=center>Registry</head>
</div>
<body>
<h2 align=center>New User Registration</h2>

<table align=center>
<tr>
<td>First Name: </td>
<td><input type="text" name="userFirst" value="#userFirst#" size="30" maxlength="30">*</td>
</tr>
<tr>
<td>Last Name: </td>
<td><input type="text" name="userLast" value="#userLast#" size="30" maxlength="30">*</td>
</tr>
<tr>
<td>User Name: </td>
<td><input type="text" name="userName" value="#userName#" size="30" maxlength="30">*</td>
</tr>
<tr>
<td>Password: </td>
<td><input type="password" name="userPWD" value="#userPWD#" size="30" maxlength="30">*</td>
</tr>
<tr>
<td>E-Mail: </td>
<td><input type="text" name="userEmail" value="#userEmail#" size="30" maxlenght="30">*</td>
</tr>
<div align="center">
<table>
<div align=center>
<input align="center" type="submit" value="submit">
</div>
</table>
</table>
<input type="hidden" name="mode" value="Submit">

</div>
</body>
</html>
chrisfusion is offline   Reply With Quote