Hi guys
I am using the below code to connect to a run a query on a microsoft access database. when i run the code i get the error:
Fatal error: Call to a member function Execute() on a non-object in C:\web\root\devfiles\accesstest.php on line 27
i cant see why i would be getting the error any halp would be aprishated.
<?php
$dbc = new COM("ADODB.Connection");
$conn = "DRIVER=Microsoft Access Driver (*.mdb); DBQ=".$_SERVER['DOCUMENT_ROOT']."/membership.mdb"; //was $connstr
$dbc->open($conn); //was $connstr
$sql = 'SELECT forename, surname
FROM members';
$rs = $conn->Execute($sql);
while (!$rs->EOF) {
?>
<tr>
<?php echo $rs->Fields['forename']->Value ?>
<?php echo $rs->Fields['surname']->Value ?>
</tr>
<?php $rs->MoveNext() ?>
<?php } ?>