<?php
set_time_limit(0);
function getContent($Content){
return preg_replace("/<(div style.*?)>(.*?)<(\/div.*?)>/si","",$Content);
}
$mdb=new com("adodb.connection");
$mdb->open("driver={microsoft access driver (*.mdb)}; dbq=D:\\php\\htdocs\\tg\\www\\db\\db.mdb");
Echo "<title>PhpMDB</title>";
Echo "<style>*{font-family:Verdana;font-size:8pt}</style>";
$result=$mdb->execute("select * from picture");
while(!$result->eof){
$desc = trim((string)$result->fields("pic_desc"));
$desc = getContent($desc);
$id = (int)$result->fields("pic_id");
$sql = "update picture set pic_desc='".$desc."' where pic_id=".$id;
$mdb->execute($sql);
echo $sql."<br /><br /><br />";
$result->movenext();
}
$mdb->close;
/*
数据库循环
$result=$mdb->execute("select top 1 * from picture where pic_id=48");
while(!$result->eof){
$desc = trim((string)$result->fields("pic_desc"));
//加上处理代码
}
*/
exit;
?>
<textarea cols=140 rows=15><?php echo $desc; ?></textarea><br />
<textarea cols=140 rows=15><?php echo $desc2; ?></textarea><br />
用PHP 操作ACCESS 过滤字段DIV不要的内容
最新推荐文章于 2021-04-03 03:41:09 发布