I saved a value as a cookie and then checked if there exists in the perfiles_vinculados table to get all the data that has the same id in the perfil table.
Then I create an array of the $vinculado result and show it in a HTML table as a row.
The problem is that the console returns:
Catchable fatal error:
Object of class mysqli_result could not be converted to string in C:\xampp\htdocs\miramonteapp\api\modal.php
The cookie:
document.cookie = "vinculaciones=" + $("#mod_id_perfil").val();
PHP:
//querys
<?php
include 'api/conexion.php';
$ides = $_COOKIE['vinculaciones'];
$juridicos = "SELECT perfil_juridica FROM perfiles_vinculados where  perfil_fisica = '$ides'";
$con = mysqli_query($conexion, $juridicos);
$vinculado = mysqli_query($conexion, "SELECT * FROM perfil where  id = '$con'");
?>
//table
<?php 
while($reg = mysqli_fetch_array($vinculado)) {
    $id = $reg['id'];  
?>
<tr id="<?php echo " tr_ ".$reg['id']; ?>">
  <td class="" data-id="<?php echo $reg['usuario'] ?>">
    <?php echo $reg['nombre']; ?>
  </td>
  <td class="" data-id="<?php echo $reg['usuario'] ?>">
    <?php echo $reg['cuit']; ?>
  </td>
  <td class="td-actions text-right">
    <button type="button" rel="tooltip" class="btn btn-danger">
      <i class="material-icons">close</i>
    </button>
  </td>
<?php } ?>
 
     
    