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

???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.