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


      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:



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



      <!--- insert statement --->


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

      <cfset IsAdmin= 0>


      <cfset IsAdmin= 1>



      <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">)



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