transfer from one database to the other [closed]

0

Hello, I'm developing a real estate website, but it already exists, so I'm just going to update it, my question is whether it is possible to transfer the properties already registered in the old site to the new one or is it impossible?

obs: the site was developed in WordPress

    
asked by anonymous 26.04.2017 / 04:25

1 answer

3

The database is not connected to Wordpress and PHP directly, this should explain some things:

In short, PHP is the language used together with Apache or Ngnix to generate dynamic pages, Mysql is a server entirely apart and PHP accesses this server through a TCP request and uses the API to facilitate you can access the Wordpress database without needing Wordpress .

The only question is how will you read the data, the Wordpress bank is very specific, the bank diagram is this:

SojustmounttheSELECTsasyouwish,somedetailsaboutthetables link

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 do not know the basics of using PHP, I recommend starting with the documentation, follow the links:

26.04.2017 / 05:15