Please login or register.

Login with username, password and session length
Advanced search  

News:

We are constantly trying to improve PHP Freaks and these forums, so feel free to go to the PHPFreaks Comments/Suggestions board and point out anything you'd like to see different!

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

Active users: homer.favenir (2)
0 Members and 1 Guest are viewing this topic.

homer.favenir

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

homer.favenir

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

 ;D ???
Logged

PHP Freaks Forums

 
 
 

Page created in 0.054 seconds with 19 queries.