Error in foreach - Notice: Array to string Conversion in

Asked

Viewed 451 times

0

I’m having difficulty generating a table using foreach, initially I’m trying to put so that appears the number of the field ID of the animal table in the table, but keeps appearing the error: Notice: Array to string Conversion in C: Users Ulisses Desktop usbwebserver- Tccc root SGS animals_registered.php on line 196

<table>
  <thead>
    <tr>
      <th>Nome do Documento</th>
      <th>Codigo de Identificação</th>
      <th>Alterar</th>
      <th>Excluir</th>

    </tr>
  </thead>

  <tbody>
    <?php 

include"cone.php";

$sql="SELECT *FROM animal";

$dados = $conn->query($sql);
$rows = $dados->fetch_assoc();

foreach($rows as $key => $value) { ?>


    <tr>
      <a>
        <th scope="row">
          <a href="#" target="_blank"> <i class="fa fa-file-pdf-o"></i> PDF </a>
        </th>
        <td>
          <?php echo $value.["id_animal"] ?>
        </td>
        <td>
          <a href="editar_animal.php">
            <i class="fa fa-edit" style="color: green; font-size: 20px;">
                                    </i>
          </a>
        </td>
        <td>
          <a href="excluir_animal.php">
            <i class="fa fa-times" style="color: red; font-size: 20px;">
                                    </i>
        </td>

        </a>
    </tr>
  </tbody>

  <?php } ?>

</table>
Imagem do tabela do banco de dados

1 answer

1

Exchange your <?php echo $value.["id_animal"] ?> for <?php echo $value["id_animal"] ?> and tries

  • I tried that. It’s not.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.