transfer from one database to another

Asked

Viewed 804 times

0

Hello guys I am developing a real estate site, however it already exists or I will just update it, my doubt is whether it is possible to transfer the properties already registered on the old site to the new or is impossible?

Obs: the site was developed in Wordpress

  • Depends kkk your question is not clear enough to generate a good answer.

  • kkk, I’ll try to explain better, the site I developed is in php and the old site is Wordpress, so I wonder if it is possible to transfer the properties that are already registered on the old site to the current site

  • exports the bank from the old site, and then imports it to the new site. See if this tutorial will help you https://mediatemple.net/community/products/dv/204403864/export-and-import-mysql-databases

  • I’ll take a look, thanks

  • wordpress is installed on your server or directly using https://br.wordpress.com/create/?

1 answer

3

The database is not connected with Wordpress or PHP "directly", this should explain some things:

Summarizing PHP is the language that used together with Apache or Ngnix generates dynamic pages, Mysql is a totally separate server and PHP makes access to this server through a TCP request and uses the API to facilitate, ie you can access the database Wordpress without needing the Wordpress.

The only question is how will read the data, the database Wordpress is quite specific, the diagram of the bank is this:

WP diagrama

Then just assemble the Selects as you wish, some details about the tables https://codex.wordpress.org/Database_Description

A very simple example of using the mysqli API to access the database on your mysql server:

<?php
$host = 'mysql.servidor.com'; //endereço do seu host
$user = 'usuario';            //usuario do banco do Wordpress
$pass = 'senha';              //senha do banco do Wordpress
$banco = 'banco_wordpress';   //nome do banco do Wordpress

//Conecta
$mysqli = new mysqli($host, $user, $pass, $banco);

if (mysqli_connect_errno()) {
    printf("Erro de conexão: %s\n", mysqli_connect_error());
    exit;
}

$query = 'SELECT * FROM wp_posts'; //Seleciona dados da tabela wp_posts (provavelmente contem seus imóveis)

if ($result = $mysqli->query($query)) {
    //... pega os dados
    $result->close();
}

$mysqli->close();

So if you don’t know yet the basics of using PHP recommend you start with the documentation, follow the links:

  • Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.