472,133 Members | 1,062 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Connecting to a Access database using ODBC and no DNS

23
Hi, I'm having problems connecting to a Microsoft Access database. Im using PHP and ODBC but im not using a DNS.

The scripts below give no errors but I they only give me a blank white screen.

Any would be greatly appresiated. Please help.

Script 1
[php]
<HTML>
<HEAD>
<TITLE> Browse the race table </TITLE>
</HEAD>
<BODY>
<?php
$connstr = "DRIVER={Microsoft Access Driver(*.mdb)};DBQ=".realpath("Database/2PointB.mdb").";";
$conn=odbc_connect($connstr,",");
$stmt=odbc_tables($conn);
while( odbc_fetch_row($stmt))
{
$tabletype = odbc_result($stmt,4);
$tablename = odbc_result($stmt,3);
if($tabletype =="TABLE")
{
Print "<a HREF=browserace.php?table=" .$tablename.">" .$tablename ."</a>";
Print "<br>";
{
}
?>
</BODY>
</HTML>[/php]Script 2[php]
<HTML>
<HEAD>
<TITLE> Browse </TITLE>
</HEAD>
<BODY>
<?php
$table=$_GET["table"];
$sql="Select * from $table";
$connstr = "DRIVER={Microsoft Access Driver(*.mdb)};DBQ=".realpath("Database/2PointB.mdb").";";
$conn=odbc_connect($connstrr,",");
$stmt=odbc_exec($conn,$sql);
$nofileds=odbc_num_fields($stmt);
while( odbc_fetch_row($stmt))
{
$i=1;
while ($i<$nofields)
{
Print odbc_result($stmt,$i)."";
$i==;
}
Print "<br>";
}
?>
</BODY>
</HTML>[/php]
Apr 12 '08 #1
1 2736
ronverdonk
4,258 Expert 4TB
You don't get an error, because you don't display any errors. Add an error display to each of the odbc_* command like[php]$conn=odbc_connect($connstr,",")
or die ("connect error: ".odbc_error());
$stmt=odbc_tables($conn)
or die ("show table error: ".odbc_error());[/php]and you'll get more information on your problem.

Ronald
Apr 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by ehendrikd | last post: by
1 post views Thread by Kavvy | last post: by
14 posts views Thread by Peter | last post: by
3 posts views Thread by Mike | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.