Jump to content

problem connecting to ms access from php. pls help. tnx


homer.favenir

how can i connect to ms access by php?  

  1. 1. how can i connect to ms access by php?

    • my code is error
      0
    • wrong connection
      0


Recommended Posts

i have a database in ms access i want to use php to enter data.

i set up my odbc in control panel.

 

here is my code in php

 

<!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','','');

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>

 

and my access is working...

 

pls help me with my code.

 

thanks

???

  • 3 weeks later...

Hmmm using something great as php and combining it with something evil from microsucks what a sin  :P using mySQL or postgresql is easier and better.

 

You're code seems good have you setup the odbc connection correctly in your Administrative Tools.

 

here is a link http://www.w3schools.com/php/php_db_odbc.asp

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.