<?
/**
*利用COM打开ACCESS,然后正常插入到数据表中
*
* @Author 苗景云
* @Date 2013/10/09
*/
//利用COM打开ACCESS数据表
$conn = @new com("ADODB.Connection") or die("ADO连接创造失败");
$connstr = "Provider=MSDASQL.1;Data Source=jingdianniansong.mdb;";
$conn->open($connstr);
$rs = @new com("ADODB.RecordSet") or die("ADO记录集创建失败");
$db = "SELECT * FROM Content";
$rs->Open($db,$conn,1,1);
$conn = mysql_connect("localhost","root","root123") or die("连接主机失败");
mysql_query('set names "utf-8"');
mysql_select_db("foshangmusic") or die("打开数据库失败");
//循环取出,插入到MYSQL数据表的相应字段中!
while(!$rs->eof)
{
// $a6 = $rs->Fields["a6"]; //此行用于截取
// if (strlen($a6) > 30)
// {
// $a6 = substr($a6,0,15);
// $a6 = $a6 . "..";
// }
$query = "INSERT INTO foshang_music_bak SET
name = '{$rs->Fields["title"]}',
cid = 3,
cname = '经典念诵',
aid = 0,
aname = '非专辑单曲',
uid = 0,
uname = '佛商网',
tpl = 'music_info.html',
path = '',
order_num = 0,
hit = 0,
tdy_hit = 0,
mth_hit = 0,
mark = 0,
mark_times = 0,
dwn_times = 0,
error = 0,
sto_num = 0,
up = 0,
down = 0,
lsn_gpid = 0,
lsn_gpname = '',
lsn_money = 0,
dwn_gpid = 7,
dwn_gpname = 'VIP',
dwn_money = 0,
sty_id = 1,
sty_name = '梵呗乐',
area_id = 1,
area_name = '内地',
lan_id = 1,
lan_name = '国语',
emo_id = 6,
emo_name = '平静',
rhy_id = 2,
rhy_name = '缓和',
is_check = 1,
is_del = 0,
is_rmd = 0,
is_create = 0,
is_org = 0,
;";
echo $query . "<br>";
mysql_query($query) or die("插入失败");
$rs->MoveNext();
}
?>
相关文章
mysql 主从表数据量差异比对2020-02-29
mysql匹配两个表的相同字段进行更新2020-02-29
MySQL/MariaDB 常用SQL语句2018-10-26
Mysql 批量修改数据库前缀程序代码2015-09-12
Mysql使用Update在原字段内容上追加2015-05-16
Access导入MySql的PHP程序2013-09-04
mysql 替换指定字符2013-08-14
Mysql连表匹配更新Update 写法2013-08-13
mysql批量去除重复内容的办法2013-08-12