The table content design cannot be modified. It is in the read-only Database $ db =$ _ SERVER ['document _ root']. "\ myfirst. mdb ";
$ Connstr = "Driver = {Microsoft Access Driver (*. mdb)}; Dbq = $ db ";
$ Connid = odbc_connect ($ connstr, "", "", SQL _CUR_USE_ODBC) or die ("failed to open the database! Contact the administrator ");
Echo 123;
$ SQL = "create table content (id counter constraint primarykey primary key, [title] varchar (50) null, [province/city] varchar (30) null, [content] varchar (255), [acquired] bit, [sent] bit )";
Echo $ SQL;
Odbc_exec ($ connid, $ SQL );
Execution result:
Warning: odbc_exec () [function. odbc-exec]: SQL error: [Microsoft] [ODBC Microsoft Access Driver] the design of the 'content' table cannot be modified. It is in a read-only database ., SQL state 42000 in SQLExecDirect in G: \ zhengli \ access. php on line 9
How to solve the error and successfully create an access table
Reply to discussion (solution)
The design of the 'content' table cannot be modified. It is in a read-only database.
Right. how can I change it? how can I create an access table in php...
The table content already exists. if you create table content again... of course, an error is returned.
Use the ALTER command to modify the table structure.
If you must create a new table, delete the table first (DROP command)
There is no table in the database, and then the Php code is used to create the table. this error is reported... How to change ..
No content table? Insufficient permissions.
Permission ??? What does this mean? how can I create a table successfully after successfully connecting to the access database in php ???
Create an empty database db1 in Access management.
Execute your code
$ Db = realpath ("db1.mdb"); $ connstr = "Driver = {Microsoft Access Driver (*. mdb)}; Dbq = $ db "; $ connid = odbc_connect ($ connstr," "," ", SQL _CUR_USE_ODBC) or die (" failed to open the database! Contact the administrator "); echo 123; $ SQL =" create table content (id counter constraint primarykey primary key, [title] varchar (50) null, [province/city] varchar (30) null, [content] varchar (255), [acquired] bit, [sent] bit) "; echo $ SQL; odbc_exec ($ connid, $ SQL );
Open it in the access manager:
Conclusion I think you have obtained
Well, my code is okay because I didn't set the access database permission, but thanks.