title: how to display all values of an array from a pdo statement?
body: <p>I'm trying to display individual values from a PDO statement to radio buttons.
  Here's what I have so far.</p>
  
  <pre><code>    &lt;?php
  
      session_start();  
      $host = "localhost";  
      $username = "root";  
      $password = "";  
      $database = "training";  
      $result = "";
  
          $connect = new PDO("mysql:host=$host; dbname=$database", $username, $password);  
  
              $query = "SELECT username FROM accounts";  
              $statement = $connect-&gt;prepare($query);
              $statement-&gt;execute();
              $result = $statement-&gt;fetchAll(PDO::FETCH_ASSOC);  
  
      echo "&lt;input type='radio' name ='president'&gt;". $result . "&lt;/input&gt;"
  
      ?&gt;
  </code></pre>
  
  <p>but it results in this</p>
  
  <blockquote>
    <p>"Notice: Array to string conversion in
    <code>C:\xampp\htdocs\testing\vote.php</code>"</p>
  </blockquote>
  
  <p>I've tried using <code>print_r($result);</code> to check the values</p>
  
  <pre><code>[0] = admin
  [1] = operation1
  </code></pre>
  
  <p>I want those values to be displayed on radio buttons text.</p>