-
您的位置:首页 → 技术开发 → 数据库技巧 → ACCESS数据库向MySQL快速迁移小程序二
ACCESS数据库向MySQL快速迁移小程序二
时间:2004/11/15 23:31:00来源:本站整理作者:蓝点我要评论(0)
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
以下为 import.php 源程序
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$dbconnection = @mysql_connect("yourmysqlserver", "mysqlaccount", "mysqlpassword")
or die ("can not connect to database server");
@mysql_select_db("yourdatabase")
or die("No Database,
") ;
$conn = odbc_connect("task", "", "");
$fp = fopen ("fdlist.txt","r") ;
$table1 = fgets($fp,200);
$fd1 = fgets($fp,1024) ;
$table2 = fgets($fp,200);
$fd2 = fgets($fp,1024) ;
$query1 = "select " . $fd1 . " from " . $table1 ;
$query2 = "select " . $fd2 . " from " . $table2 . " where 1=2 " ;
$result = mysql_query ($query2) ;
mysql_query ("delete from " .$table2 ) ;
echo "sql=". $query1;
$recordsid = odbc_exec($conn, $query1);
$idcounts = odbc_num_fields( $recordsid ) ;
$idcount2 = mysql_num_fields($result) ;
if ( $idcounts != $idcount2 )
die (" The fields of two tables doesn't match ") ;
echo "
查看所有0条评论>>