Click to See Complete Forum and Search --> : OBDC Connect to Access 2000


Anon
11-14-2000, 08:26 PM
I am new to PHP. I am running win NT and PHP4 with IIS. PHP is running and a test page works.

I have tried the following connection to the DB which the ODBC is set up:

<?php

// create connection
$connection = odbc_connect("../0master/database/Master","","")
or die("Couldn't connect to datasource.");

// create SQL statement
$sql = "SELECT AdCatID, Category,
FROM adcategories
ORDER BY Category";

// prepare SQL statement
$sql_result = odbc_prepare($connection,$sql)
or die("Couldn't prepare query.");

// execute SQL statement and get results
odbc_execute($sql_result)
or die("Couldn't execute statement.");

// format result in HTML table
odbc_result_all($sql_result,"border=1");

// free resources and close connection
odbc_free_result($sql_result);
odbc_close($connection);

?>

The Error I get is in the Connection:

<br>
<b>Warning</b>: Failed opening 'C:\InetPub\wwwroot\0masterfile\classads\classadsPHP.php' for inclusion (include_path='') in <b>Unknown</b> on line <b>0</b><br>

Anon
11-15-2000, 03:17 AM
You need to create a DSN from ODBC in the control panel first.

See http://php.weblogs.com/odbc for tutorials on how to do so.