Pdostatement::fetch_array()

Asked

Viewed 32 times

0

I’m having a problem at a input of the kind Select (follows the excerpt below). I am using version 7.0 of PHP and as DBMS Postgresql. I tried to use the function pg_fetch_array but it was unsuccessful, someone has an idea of what might be wrong?

Display Error

<?php
    $consulta = "SELECT * FROM atividades";
    $query = $db->db->query("SELECT * FROM atividades");
?>
 <select>
          <?php 
            echo "<select name='descricao'>";
              while($cont = $query->fetch_array()) {
                echo "<option value='".$cont["id"]."'>".$cont["descricao"]."</option>";
              }
            echo "</select>";
          ?>
      </select>

inserir a descrição da imagem aqui

This is the return specified by var_dump($query);

  • Before executing $query->fetch_array(), do var_dump($query) and put here the result.

  • post the connection code $query->fetch_array(PDO::FETCH_ASSOC) of a var_dumb($cont);

  • remembering that you have to give $query->execute();

No answers

Browser other questions tagged

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