Print mysql of 2 tables for data comparison

0

Hello I will explain briefly what I want to do is store projections the information of what your goals were in a different database and in a table called projection and your current sales are in another database in table sale I want to print in a single table both its projection and its current sale to make an operation on what percentage carry my code according to your goal at least data collection is as follows

<h4>
$cadena1 = "SELECT distinct(sucursal) from ventas limit 5 ";
$registro = mysqli_query($conexion, $cadena);
$registro1 = mysqli_query($conexion1, $cadena1);

echo '
  <table class="table table-striped table-condensed table-hover table-responsive">
            <tr class="info">
                <th width="300">NOMBRE</th>
                <th width="">MONTO</th>
                <th width="">venta</th>
            </tr>';
if ((mysqli_num_rows($registro) > 0) && (mysqli_num_rows($registro1) > 0)) {
    while($registro2 = mysqli_fetch_array($registro) && $registros = mysqli_fetch_array($registro1)) {
        echo '<tr>
            <td>' . $registro2['nombre_sucursal'] . '</td>
            <td>' . $registro2['monto'] . '</td>
            <td>' . $registros['sucursal'] . '</td>
        </tr>';
</h4>

In register1 and string 1 you are using a different connection to the other base and the query to the other table and place it in the mum while you have to go through at least 50 records .. if you can or have a better idea I will be grateful

    
asked by Izzyz Tvr 13.03.2018 в 20:39
source

0 answers