Copy link to clipboard
Copied
Can someone tell me what is wrong with this code? I'm getting a too few parameters expected 4 error.
<cfquery datasource="poll" name="registration">
INSERT INTO Members(login,password,first_name,last_name,email,phone,address)
VALUES ("#form.username#","#pw#","#form.firstname#","#form.lastname#","#form.email#","#form.phone#","#form.address#")
</cfquery>
All database fields are text even for the phone number and password.
Copy link to clipboard
Copied
Use single quotes in place of double quotes.
Copy link to clipboard
Copied
Even better, use cfqueryparam thus:
... VALUES (<cfqueryparam value="#form.username#" cfsqltype="cf_sql_varchar"> , <cfqueryparam value="#pw#" cfsqltype="cf_sql_varchar">,...etc)