Jump to content
Fórum Script Brasil
  • 0

Transferindo Dados De Um Banco Acess Para O Mysql


Beraldo
 Share

Question

Script postado por: Fabyo

Transferindo dados de um banco Acess para o MySQL

conecta.php:

<?

/*Autor Fabyo guimaraes*/

$cfg_dsn = "DRIVER=Microsoft Access Driver (*.mdb);

DBQ=C:/root/acess/banco.mdb;

UserCommitSync=Yes;

Threads=3;

SafeTransactions=0;

PageTimeout=5;

MaxScanRows=8;

MaxBufferSize=2048;

DriverId=281";

$cfg_dsn_login = "";

$cfg_dsn_mdp = "";

$conexao=odbc_connect($cfg_dsn,$cfg_dsn_login,$cfg_dsn_mdp);

?>

<?php

/* Esse script pega todos os dados do banco acess e grava no banco mysql

Autor : Fabyo Guimaraes*/

//conexao com o banco mysql

$cn = mysql_connect("localhost");

mysql_select_db("banco", $cn);

//conexao com o banco acess

include "conecta.php";

//seleciona a tabela do banco acess

$execute = odbc_exec($conexao,"SELECT * FROM tabela");

while($coluna = odbc_fetch_array($execute)){

$nome = $coluna["nome"];

$senha = $coluna["senha"];

//aqui grava todos os registros do banco acess para o mysql

$sql = "INSERT INTO tabela VALUES ('', '$nome', '$senha')";

mysql_query($sql);

}

?>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      151k
    • Total Posts
      649.1k
×
×
  • Create New...