复制代码 代码如下:
<?php
header('ontent-Type:text/html;charset=GB2312');//避免输出乱码
$dbhost ="localhost";
$dbuser ="root";
$dbpassword = "123456";
$dbname = "139miaosha";
mysql_connect($dbhost,$dbuser,$dbpassword) or die("error!");
mysql_query("set names 'gbk'");
mysql_select_db('139miaosha');
$conn = new com("ADODB.Connection");
$connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=F:/wamp/www/miaosha/ruichao858.mdb";
$conn->Open($connstr);
$rs = new COM("ADODB.RecordSet");
$rs->Open("select * from News where bigclassname='装修课堂'",$conn,1,3);
while(!$rs->eof){
switch ($rs->Fields[4]){
case "装修顾问":
$sclass=1;
break;
case "厨卫空间":
$sclass=2;
break;
case "家具物语":
$sclass=3;
break;
case "电器工程":
$sclass=4;
break;
case "居饰风景":
$sclass=5;
break;
case "材料广角":
$sclass=6;
break;
default:
$sclass=1;
}
if ($rs->Fields[6]){
$spic="";
}else{
$spic=$rs->Fields[6];
}
if ($rs->Fields[7]){
$user="";
}else{
$user=$rs->Fields[7];
}
if ($rs->Fields[9]){
$hits=1;
}else{
$hits=$rs->Fields[9];
}
$sql="insert into rc_news(n_title,n_content,n_bclass,n_sclass,n_pic,n_spic,n_user,n_hits,n_audit) values('".$rs->Fields[1]."','".$rs->Fields[2]."',1,".$sclass.",'','".$spic."','".$user."',".$hits.",1)";
$result=mysql _query($sql);
//echo $rs->Fields[1];
//echo "<br/>";
$rs->Movenext(); //将记录集指针下移
}
$rs->close();
?>
<?php
header('ontent-Type:text/html;charset=GB2312');//避免输出乱码
$dbhost ="localhost";
$dbuser ="root";
$dbpassword = "123456";
$dbname = "139miaosha";
mysql_connect($dbhost,$dbuser,$dbpassword) or die("error!");
mysql_query("set names 'gbk'");
mysql_select_db('139miaosha');
$conn = new com("ADODB.Connection");
$connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=F:/wamp/www/miaosha/ruichao858.mdb";
$conn->Open($connstr);
$rs = new COM("ADODB.RecordSet");
$rs->Open("select * from News where bigclassname='装修课堂'",$conn,1,3);
while(!$rs->eof){
switch ($rs->Fields[4]){
case "装修顾问":
$sclass=1;
break;
case "厨卫空间":
$sclass=2;
break;
case "家具物语":
$sclass=3;
break;
case "电器工程":
$sclass=4;
break;
case "居饰风景":
$sclass=5;
break;
case "材料广角":
$sclass=6;
break;
default:
$sclass=1;
}
if ($rs->Fields[6]){
$spic="";
}else{
$spic=$rs->Fields[6];
}
if ($rs->Fields[7]){
$user="";
}else{
$user=$rs->Fields[7];
}
if ($rs->Fields[9]){
$hits=1;
}else{
$hits=$rs->Fields[9];
}
$sql="insert into rc_news(n_title,n_content,n_bclass,n_sclass,n_pic,n_spic,n_user,n_hits,n_audit) values('".$rs->Fields[1]."','".$rs->Fields[2]."',1,".$sclass.",'','".$spic."','".$user."',".$hits.",1)";
$result=mysql _query($sql);
//echo $rs->Fields[1];
//echo "<br/>";
$rs->Movenext(); //将记录集指针下移
}
$rs->close();
?>
标签:
ACCESS,MYSQL
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“PHP读取ACCESS数据到MYSQL的代码”评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?