0

I am looking for a way to access each row individually. I want to add these as options in a <select> tag and that's why i need each individually.

I was thinking of using the $data variable but when i put $data['id'][1] it would just show the 2nd character. When i used $d[1] it would give me a fatal error.

This is my code:

$pdo = new PDO("mysql:host=localhost;dbname=liamed", "root", "");
      $query = "select * from users";
      $d = $pdo->query($query);
      foreach ($d as $data){

    ?>

    <tr>
      <td><?php echo $data['id'];?></td>
      <td><?php echo $data['nume'];?></td>
      <td><?php echo $data['prenume'];?></td>
    </tr>
  <?php }
  ?>

Thanks!

Victor
  • 7
  • 2

0 Answers0