How to connect to Microsoft Access?
$db =& ADONewConnection(’access’);
$dsn = “Driver={Microsoft Access Driver (*.mdb)};Dbq=c:/nil/db1.mdb;Uid=Admin;Pwd=;”;
$db->Connect($dsn);
How to connect to Microsoft Excel using ODBC_CONNECT?
$excelFile = realpath(’c:/nil/InfoCaptor/dashboards/test_data.xls’);
$excelDir = dirname($excelFile);
$connection = odbc_connect(”Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir” , ”, ”);
$result=odbc_exec($connection, ’select * from [detail_data$]‘);
echo “<table align=\”center\” border=\”1\” borderColor=\”\” cellpadding=\”0\” cellspacing=\”0\”>\n”;
echo “<tr> “;
// — print field name
$colName = odbc_num_fields($result);
for ($j=1; $j<= $colName; $j++)
{
echo “<th [...]
Archive for the ‘Connections’ Category
Connecting to various databases using PHP
January 13th, 2009
No Comments

