I have successfully retrieve data from MS Access to PHP using the commands below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?
$dbc=odbc_connect("guestbook","","");
if (!$dbc)
{exit("Connection Failed: " . $dbc);}
$query="SELECT * FROM comments";
$rs=odbc_exec($dbc,$query);
if (!$rs)
{exit("Error in SQL");}
echo '<h3>MS Access powered Guest Book</h3>';
while (odbc_fetch_row($rs))
{
$e_name=odbc_result($rs,"name");
$comment=odbc_result($rs,"comment");
$e_date=odbc_result($rs,"entry_date");
echo '<b>Name:</b>'.$e_name.'<br>';
echo '<b>Comments:</b> '.$comment.'<br /> <b>Date:</b> '.$e_date.'<br />
<hr/>';
}
odbc_close($dbc);
echo "</table>";
?>
</body>
</html>
The problem I am having now is how to make the data into table format (in rows and columns).
Does anyone have any reference/advice to this? Thanks a lot. 🙂