Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem with insert statement.

Contributor ,
Nov 27, 2012 Nov 27, 2012

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.

485
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2012 Nov 27, 2012

Use single quotes in place of double quotes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2012 Nov 27, 2012
LATEST

Even better, use cfqueryparam thus:

... VALUES (<cfqueryparam value="#form.username#"  cfsqltype="cf_sql_varchar"> , <cfqueryparam value="#pw#"  cfsqltype="cf_sql_varchar">,...etc)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources