Posted by M on 07/12/05 17:23
Hi Folks,
I don't seem to be able to get DB::execute to work using an ODBC
datasource and a MS-Access Database.
Can anyone tell me if I am doing something wrong, or is there a bug in
the DB class?
Code fragment is below.
Regards,
Martin
<?php
require_once "DB.php";
$dsn ="odbc(access)://tcp()driver=Microsoft Access Driver
(*.mdb);dbq=C:\\PrjData\\TestScripts\\TestScript.mdb";
$conn = DB::connect ($dsn);
if (DB::isError ($conn))
die ("Cannot connect: " . $conn->getMessage () . "\n");
$updateQuery="UPDATE Book1 SET SubCategory = ? WHERE ID = ?;";
$sth = $conn->prepare($updateQuery);
if (PEAR::isError($sth))
{
die($sth->getMessage());
}
echo "<br> Prepare OK <br>";
$data = array('1','1');
//print_r($data);
$res1 =& $conn->execute($sth, $data);
if (PEAR::isError($res1))
{
die($res1->getMessage());
}
echo "Update OK <br>";
?>
[Back to original message]
|