viernes, 26 de junio de 2015

MySql DB: conexion a 2 bases de datos al mismo tempo

<?php
$conViejo = mysqli_connect("cavdp02","root","lietome","mpdportal");
$conNuevo = mysqli_connect("cavdp03","root","lietome","bdnuevoportal");
// Check connection
if (mysqli_connect_errno())
{
 echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// Perform queries 
$result =  mysqli_query($conViejo,"SELECT * FROM archivos_contenidos");
$row = mysqli_fetch_array($result);

echo "<pre>";
print_r($row);
echo "</pre>";

echo "<hr>";
$result =  mysqli_query($conNuevo,"SELECT * FROM wp_content");
$row = mysqli_fetch_array($result);

echo "<pre>";
print_r($row);
echo "</pre>";