示例#1
0
$dst_db = new MySQLDatabase();
$dst_db->dbconnect($dst_dbhost, $dst_dbuser, $dst_dbpass, 'uchome');
$userlist = array();
$src_db = new MySQLDataBase();
$src_db->dbconnect($src_dbhost, $src_dbuser, $src_dbpass, $src_dbname);
$strSQL = sprintf("SELECT uid, username,password,email,regip, regdate FROM uc_members ");
$result = $src_db->query($strSQL);
while ($myrow = $src_db->fetchArray($result)) {
    /*
    $user['uid'] 		= $myrow['uid'];
    $user['username'] 	= $myrow['username'];
    $user['password']	= $myrow['password'];
    $user['email']		= $myrow['email'];
    $user['regip']		= $myrow['regip'];
    $user['regdate']	= $myrow['regdate'];
    */
    /*
    foreach($myrow as $key => $value)
    	$user[$key] = $value;
    $userlist[]  = $user;
    */
    $strSQL = sprintf("REPLACE INTO oss_members (uid,username,groupid,password,dateline,updatetime,lastlogin,ip) \n\t\t\t\tVALUES (%d,%s,%d,%s,%d,%d,%d,%s)", $myrow['uid'], $dst_db->quoteString($myrow['username']), 2, $dst_db->quoteString($myrow['password']), $myrow['regdate'], $myrow['regdate'], $myrow['regdate'], $dst_db->quoteString($myrow['regip']));
    echo $strSQL . ";\n";
    //	$dst_db->query($strSQL);
}
$src_db->freeRecordSet($result);
unset($src_db);
unset($dst_db);
?>