Author Topic: how can i connect to ms access using php? pls help. tnx  (Read 397 times)

0 Members and 1 Guest are viewing this topic.

Offline homer.favenirTopic starter

  • Enthusiast
  • Gender: Male
    • View Profile
how can i connect to ms access using php? pls help. tnx
« on: September 08, 2007, 07:06:45 PM »
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
 ???

Offline homer.favenirTopic starter

  • Enthusiast
  • Gender: Male
    • View Profile
Re: how can i connect to ms access using php? pls help. tnx
« Reply #1 on: September 08, 2007, 08:13:15 PM »
bumping this post.

 ;D ???

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.