把access导入mysql的php编程源代码
根据access表格和mysql表格的具体字段修改以下内容就可以了
<?php
$conn = new com("adodb.connection");
$connstr="driver={microsoft access driver (*.mdb)};dbq=". realpath("zzzyk.mdb");
$conn->open($connstr);
?>
<?php
$sql="select * from zhaoxi_net"; //查询语句
$rs=new com("adodb.recordset"); //发送一个语句的类
$rs->open($sql,$conn,1,3); //打开连接的数据库
$i = 0;
?>
<table>
<?php
while(!$rs->eof)
{
$fields=$rs->fields(id);$id = $fields->value;
$fields=$rs->fields(name);$name = $fields->value;
$fields=$rs->fields(易做图);$wangzhi = $fields->value;
$fields=$rs->fields(see);$see = $see->value;
$fields=$rs->fields(vip);$vip = $fields->value;
$conn_q=mysql_connect("localhost","root","root") or die("1.未连接成功服务器!");
mysql_select_db("wangzhi",$conn_q) or die("2.未连接成功数据库!");
mysql_query("set names gb2312") or die("汉字编码出错");
mysql_query("insert into caigou (name,wangzhi,see,vip)values('$name','$wangzhi','$see','$vip')") or die("3.添加未成功!".$mysql_error);
// $sql=mysql_query("insert into tb_affiche(title,content,createtime)values('$title','$content','$createtime')");
if($i%6 == 0){
echo "<tr>";
};
?><td><?php echo $id;?>
<a href="<?php echo $易做图;?>" target="_blank"><?php
if($vip < 3 and $vip !=""){echo "<b>";}
echo $name;
if($vip < 3 and $vip !=""){echo "</b>";}
?></a>
</td>
<?php
$rs->movenext;
if($i % 6 == 5){
echo "</tr>";
}
if($i % 30 == 29){
echo "<tr height='12px' bgcolor='#00CC00'><td ></td><td></td><td></td><td></td><td></td><td></td></tr>";
}
$i ;
}
?></table>