How to insert data to Ms access database using php.
Posted: Sun Apr 10, 2005 1:55 am
I already connect to MS access with php. Now please help me....How to insert data to Ms access database using php.
Thanks in advance.
Code below:
feyd | Please review how to post code using
Thanks in advance.
Code below:
Code: Select all
<?php
if (!$conn = new COM("ADODB.Connection"))
exit("Unable to create an ADODB connection<br>");
$strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("SCJPTIS_IDB.mdb");
$conn->open($strConn);
$strSQL = "SELECT * FROM PROJECTS ORDER BY [PROJ_ID]";
$rs = $conn->execute($strSQL);
$PROJ_ID = $rs->Fields(0);
$PROJ_NAME = $rs->Fields(1);
echo "Table: Projects";
print "<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\">";
print "<tr bgcolor=#FFB164><td>ID</td><td>Name</td></tr>";
while (!$rs->EOF)
{
print "<tr bgcolor=\"#1AFFFF\"><td>$PROJ_ID->value</td>";
print "<td>$PROJ_NAME->value</td></tr>";
$rs->MoveNext();
}
print "</table>";
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
?>feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]