6 Replies Latest reply on Dec 9, 2011 11:07 AM by BKBK

    using a cfinput checkbox with a MySQL db issue

    cfsetNewbie Level 1

      Hello;

      I'm trying to use a checkbox to enable a person as a user in an admin section for a site. I am posting the code I am using, it works in SQL and access, but I am unsure of what the setting is for a field using yes/no - on/off type of input. Can anyone help me with what the setting is for mySQL?

       

      My code:

       

      <form>

      <cfinput type="checkbox" value="admin" name="admin">

      </form>

       

      <!--- insert statement --->

       

      <cfif not IsDefined("FORM.admin")>

      <cfset IsAdmin= 0>

      <cfelse>

      <cfset IsAdmin= 1>

      </cfif>

       

      <cfquery datasource="#APPLICATION.dataSource#" dbtype="ODBC">

      INSERT INTO adminUser

      (Fname, Lname, userName, password, email, _phone, isAdminstrator)

      VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Fname#">,

      <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Lname#">,

      <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.userName#">,

      <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.txtPassword#">,

      <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.email#">,

      <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.phone#">,

      <cfqueryparam value="#IsAdmin#" CFSQLType="CF_SQL_INTEGER">)

      </cfquery>

       

      I know it's how i have this cell set in my DB. Can anyone help me out?

       

      Thanks