PHP DB Access Insert

 

- Info:

- This tutorial shows how to use PHP to INSERT into Access DB.

 

- Example:

- Create PHP Console Application Insert.php.

 

Insert.php

<?php

#CONNECT TO DB.

$db = 'D:\Temp\PHP\guestbook.mdb';

$conn = new COM('ADODB.Connection');

$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

#EXECUTE STATEMENT.

$sql = "INSERT INTO PEOPLE(NAME, AGE) VALUES('Jill', 23)";

$rs = $conn->Execute($sql);

?>