Has anyone enconted this error before:

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] The INSERT INTO statement contains the following unknown field name: 'suffix'. Make sure you have typed the name correctly, and try the operation again., SQL state S0022 in SQLExecDirect in C:\wamp\www\form.php on line 105

Line 105 =

$rs = odbc_exec($conn,$sql);

    Well, what is the content of $sql? Is it a valid query using valid field names? Try echo-ing it out to see what the actual query looks like that you are trying to execute.

      No, echo the variable $sql so you can see what it actually looks like.

      echo $sql;
      

      Then compare it to what you expected it to look like, and verify that all field names it uses are correct. The error message is telling you that it uses a field name called "suffix", which apparently is not valid for the table being queried, so you want to find out where that name is being used in the actual query and then adjust things as necessary to correlate correctly with your database table(s).

        Nog's on it, beat me to the punch.

          Thanks I got a sneaking suspicion I know the problem. Will post back later.

            Ok fixed that problem and have another:

            Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be added; no insert permission on 'BMCactive'., SQL state 42000 in SQLExecDirect

              Sounds like the database user you are connecting with does not have "insert" permission. You will either need to connect with a different user or modify that user's permissions.

                Well, the DB I am forced to use is (Cough.. Access97) which has a password and username to open the db. I will try it at home with 2003 and see what I get. Wish I could use mysql.

                  Write a Reply...