odbc能简单操作access,但是不能limit,access本身没有该功能
//用odbc_connect函数连接access数据库
$connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=".realpath($realpath);
$conn=odbc_connect($connstr,$username,$psw,SQL_CUR_USE_ODBC );
//数据库语句
$sql="select {$fields_str} from {$table} where {$field_id}>100";
$query=odbc_exec($conn,$sql);
if(empty($query)){
break;
}
$is_next=0;
while(odbc_fetch_row($query)){
// $is_next=1;
$update='';
foreach($fields as $v){
$str = odbc_result($query,$v);
if($v==$field_id){
$id=intval($str);
$step=$id;
}else{
if(in_array($v,$fields_content)){
file_put_contents('log/'.$id.'.text', $id.$str);
$is_content=1;
}else{
$is_content=0;
}
$find=word_search($str,$words,$charset,$is_content);
if($find!==''){
echo '<p>find-str:'.$find.'</p>';
$update=",".$v."='".$str."'";
}
}
}
if($update != ''){
$update=substr($update,1);
$sql_update="update {$table} set {$update} where {$field_id}={$id}";
echo '<p>'.$sql_update.'</p>';
odbc_exec($conn,$sql_update);
}
}