Can anyone assist me. I keep getting and error stating that the Column count doesnt match row 1. I have counted all of my fields and referenced all of them but still no dice.

$con=mysql_connect($host, $username, $pass);
    die("Could Not Connect: ".mysql_error());

    $addNew=mysql_query("INSERT INTO $mirtable ( ID, EscNum , EscSentID, CSRSentID, CustFName, CustLName, AcctNum, AcctType, CustCode, Issue, STN, AuthSys, SSID, CBR, Program) VALUES('', '$EscNum', '$EscSentID', '$CSRSentID', '$CustFName', '$CustLName', '$AcctNum,' '$AcctType', '$CustCode', '$Issue', '$SourceTN', '$AuthSys', '$SSID', '$CBR', '$Program')") or die ("Error in query: .\n\nQuery: $addNew\n\nError: " .mysql_error());

Edited by diafol: appy code tags

6 Years
Discussion Span
Last Post by doubleN

When using the insert statement, there is no need to include the "ID" field. Since your database has auto encriment, it will add it for you automatically. So take out the "ID" in the INSERT statement and '' in the VALUES.


I ran into the same error.
What I did was break the SQL statement up and not save it all in one go. Use the INSERT to place the first name, last name, CBR, and account numbers. Then use UPDATE to fill in the remaining information.

FYI - You don't need to transfer your POST variables into different variables to save them into a database, you can save the directly to your database and elimate that step. Move the '' to the front and end of the variable
Example: '$_POST[CustLName]' *INSTEAD OF* $_POST['CustLName']


The problem is that the comat after


is not out. So MySQL engine thing that you want to store less than the column you define. Set it like this


Hope this helpful for other developers. Excuse my english, my language is french

This topic has been dead for over six months. 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.