Jump to content

how can i connect to ms access using php? pls help. tnx


homer.favenir

Recommended Posts

ive already set the odbc in control panel for ms access driver

but there is still an error:

 

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\wamp\www\first project\msaccess_conn.php on line 10

 

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\wamp\www\first project\msaccess_conn.php on line 17

Error in SQL

 

My code in php are:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<?php

$conn=odbc_connect ('yhentry.mdb','','');

if ($conn)

{

exit ("Connection Failed" . $conn);

}

 

$sql="Select * from YH Entry";

$rs=odbc_exec($conn,$sql);

 

if (!$rs)

{

exit ("Error in SQL");

}

 

echo "<table><tr>";

echo "<th>Directory Name</th>";

echo "<th>Filename</th>";

 

while (odbc_fetch_row($rs))

{

$directory=odbc_result($rs,"Directory");

$filename=odbc_result ($rs,"Filename");

echo "<tr><td>$directory</td>";

echo "<td>$filename</td></tr>";

}

odbc_close ($conn);

echo "</table>";

 

?>

</body>

</html>

 

 

can anyone pls tell me the problem and solutions.

 

thanks

???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.