0

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

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by focusondot
0

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

0

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.

0

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

0

Got it, thanks again

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.