DNS-less ODBC php
Hi, can anyone help me?
I am receiving this error:
Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource
inwebserver\webroot\test\thought.php on line 14. Error in SQL
As far as I understand, the query is correct and I have . Below is the code which I am using:
<?php
$conn = new COM('ADODB.Connection');
$db = 'webserver\morrislgn\database\firstchurch.mdb';
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$date = date("jm");
$sql="SELECT * FROM thoughts where date = $date";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit( "Error in SQL" );
}
echo ( "<table>" );
while (odbc_fetch_row($rs))
{
$date = odbc_result ( $rs, "Date" );
$title = odbc_result ( $rs, "Title" );
$ref = odbc_result ( $rs, "Reference" );
$thought = odbc_result( $rs, "Thought" );
$author = odbc_result( $rs, "Author" );
and the code goes on to write the info to the page through a series of echo commands
Any ideas, workarounds or suggestions for better ways to code this?
cheers,
Morris
|