Hi Community of DANIWEB, first time here, first post below...and I'm pretty new at this as well. I'm getting this error "Column count doesn't match value count at row 1"

My code is:

$insertSQL = sprintf("INSERT INTO tearSheet (".

    "compType, ".

    "compType2, ".

    "report_date, ".

    "numEmployees, ".

    "cliNumber, ".

    "execSummary, ".

    "facilities, ".

    "growth, ".

    "induClass, ".

    "priOffice, ".

    "gross_revenue, ".

    "earnRevenue, ".

    "total_assets, ".

    "contactsInNego, ".

    "fiscalYear, ".

    "typeIncorporation, ".

    "stateInc, ".

    "accountingMet, ".

    "contact_person, ".

    "buyTitle, ".

    "buyEmail, ".

    "buyTelephone, ".

    "yearEstab) ".

    "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

    GetSQLValueString($_POST['companyType'],            "text"),

    GetSQLValueString($_POST['companyType2'],           "text"),

    'now()',

    GetSQLValueString($_POST['numEmployees'],           "text"),

    GetSQLValueString($_POST['clientNumber'],           "text"),

    GetSQLValueString($_POST['execSummary'],            "text"),

    GetSQLValueString($_POST['facilities'],             "text"),

    GetSQLValueString($_POST['growth'],                 "text"),

    GetSQLValueString($_POST['industryClass'],          "text"),

    GetSQLValueString($_POST['primaryOffice'],          "text"),

    GetSQLValueString($_POST['gross_revenue'],          "text"),

    GetSQLValueString($_POST['earnedRevenue'],          "text"),

    GetSQLValueString($_POST['total_assets'],           "text"),

    GetSQLValueString($_POST['contractsInNegotiation'], "int"),

    GetSQLValueString($_POST['fiscalYear'],             "text"),

    GetSQLValueString($_POST['typeIncorporation'],      "text"),

    GetSQLValueString($_POST['stateIncorporation'],     "text"),

    GetSQLValueString($_POST['accountingMet'],          "text"),

    GetSQLValueString($_POST['contact_person'],         "text"),

    GetSQLValueString($_POST['buyTitle'],               "text"),

    GetSQLValueString($_POST['buyEmail'],               "text"),

    GetSQLValueString($_POST['buyTelephone'],           "text"),

    GetSQLValueString($_POST['yearEstab'],              "text"));



  mysql_select_db($database_contra, $contra);

  $Result1 = mysql_query($insertSQL, $contra) or die(mysql_error());

If you guys please can give some advice, any help is really appreciated.

Philly - boy

well, you've got 23 values to set ... and just 22 values SET ! (count the number of %s, %s ... you've gotta add one there).

It is working now, Thanks, I had tried that already but some how I was getting the report_date mixed up with the numEmployees, don't know why but is working now. Thanks MindSter really appreciate it.

It is working now, Thanks, I had tried that already but some how I was getting the report_date mixed up with the numEmployees, don't know why but is working now. Thanks MindSter really appreciate it.

well, you've got 23 values to set ... and just 22 values SET ! (count the number of %s, %s ... you've gotta add one there).

Glad I could help; You can mark the thread now as solved :)

Got it, thanks again

Glad I could help; You can mark the thread now as solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.