Print the two variables of two tables

0

My problem is this: I want to print the result of two fields that are in two different tables and that show like this:

field1-table1
field1-table2
field1-table1
campo1-tabla2

What I have is this and it prints me the values of one table (field) and then the other:

$connect = mysqli_connect("", "", "", "");
$request = mysqli_real_escape_string($connect, $_POST["bl3"]);
$query = "SELECT bl FROM caso WHERE bl LIKE '%".$request."%' UNION SELECT bl FROM csuelta WHERE bl LIKE '%".$request."%'";

$result = mysqli_query($connect, $query);

$data = array();

if(mysqli_num_rows($result) > 0)
{
 while($row = mysqli_fetch_assoc($result))
 {
 echo  $data[] = $row["bl"];
 }
 
}
    
asked by Leonardo Rodríguez 26.04.2018 в 00:02
source

0 answers