I am trying to insert form data into an Access database in PHP. The code is as follows :
Neither of the above two queries work!
The page is parsed without any errors (i have e_all turned on in php.ini) but it does not insert the data into the database! The database contains a single table called "Transfer" and I'm connecting to the database using the following code:
I have a different PHP script I had written to read from an access database and I set up the connection for it in the exact same way and the query was:
where 2002 is the table name and "Last Name" and "First, Middle" are columns.
Anyone have any idea what I could do?
PHP:
$query = "insert into Transfer (Date,Rep,DL,Name,Contact,Issue,Comments) VALUES (\"".$date."\",\"".$rep."\",\"".$dl."\",\"".$contact."\",\"".$issue."\",\"".$comments."\");";
//$query = "insert into [Transfer] ([Transfer].[Date],[Transfer].[Rep],[Transfer].[DL],[Transfer].[Name],[Transfer].[Contact],[Transfer].[Issue],[Transfer].[Comments]) VALUES (\"".$date."\",\"".$rep."\",\"".$dl."\",\"".$contact."\",\"".$issue."\",\"".$comments."\");";
$result = $conn->execute($query);
Neither of the above two queries work!
The page is parsed without any errors (i have e_all turned on in php.ini) but it does not insert the data into the database! The database contains a single table called "Transfer" and I'm connecting to the database using the following code:
PHP:
$conn = new COM('ADODB.connection');
$connstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".realpath('C:/apache2/htdocs/ddo/db2.mdb');
$conn->open($connstring);
I have a different PHP script I had written to read from an access database and I set up the connection for it in the exact same way and the query was:
PHP:
$query = "select * from 2002 where [2002].[Last Name]='$searchkey' order by [2002].[First, Middle];";
Anyone have any idea what I could do?













