I'm apparently having some trouble with an odbc connection. I deliberately to debug put the connect script in the main, but still no luck. odbc sees a true $link, but thinks it's not a 'resource'.
I get
Code:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
if(session_id() == '') session_start();
$debugOn=0;
global $link;
ob_start();
foreach(PDO::getAvailableDrivers() as $driver) {
echo $driver.'<br />';}// prints mysql,odbc,sqlite, so looks like the driver is there
$sql="SELECT ISCHECKED FROM KTIMP";
$dsn="C:\users\me\Desktop\sample\Sample.accdb";
$link = new PDO(
"odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};
Dbq=$dsn;Uid=; Pwd=;");
/* just a small test, grab the options to use later in listbox, e.g.
<?php
for($x=0;$x<$arrlength;$x++) {$str="
<option value=".'"'. $var[$x] .'">'.$var .'</option>'; echo "$str";}?>*/
$Result = odbc_exec( $link, $sql );//
$indxd=0;
while( odbc_fetch_row( $Result ) )
{ $option = odbc_result($Result, 1);
$var[$indxd]=$option; $indxd++;
}
$arrlength=count($var);
if($link){echo "link not null";}// this says link not null
?>
Warning: odbc_exec() expects parameter 1 to be resource, object given