Hi - the code is so simple, I just use it to test queries and it's never caused problems
<?php
// grab those statments
$statements=read_sql();
$dbh=odbc_connect_mdb("C:\databases\Model2002.mdb") or die("Couldn't Connect to Database");
foreach($statements as $query)
{
print "<i><b>Query:</b></i> '$query' ";
$time1=getmicrotime();
$sth=odbc_exec($dbh,$query); //this does the job of both above
@odbc_result_all($sth, "BGCOLOR=#DDDDDD border=1 cellspacing=0");
$time2=getmicrotime();
$time2-=$time1;
print " - <b>Time:</b> $time2<br>";
odbc_free_result($sth);
}
odbc_close($dbh);
// reads in sql statements from a textfile - very simple comment and line termination
function read_sql($filename="sql.txt")
{
$statements=array();
if( ($fp=fopen($filename, "r"))==0) die("CRITICAL ERROR: Can't open file $filename");
$count=0;
while($line=fgets($fp))
{
if(strstr($line,"__END__")) {break;}
$line=trim($line);
if(NULL==$line || strstr($line,"//") )continue;//line was empty or a comment
@$statements[$count].="$line ";
if(strstr($line,";") ) {$count++;}
}
fclose($fp);
return $statements;
}
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
function odbc_connect_mdb($filename, $user="", $password="")
{
$connStr="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=$filename";
return odbc_connect($connStr, $user, $password);
}
?>
I'll try it with PWS and see if it's BadBlue causing problems.
Cheers.