title: Why am I getting the same column twice in my PHP | PostgreSQL query?
body: <p>I have a Postgres database from which I retrieve data with a PHP script. Inside this script I connect through PDO:</p>
  <pre><code>$connection = new PDO('pgsql:host=' . $host . ';dbname=' . $database, $username, $password);
  </code></pre>
  <p>Then, I have a query which should just list the <code>id</code> of each instance:</p>
  <pre><code>$query = 'SELECT id FROM my_table WHERE &quot;myCondition&quot; = TRUE';
  </code></pre>
  <p>Then I am getting the result of my query:</p>
  <pre><code>$result = $connection-&gt;prepare($query) or die($connection-&gt;error);
  $result-&gt; execute();
  </code></pre>
  <p>And finally, I print my results:</p>
  <pre><code>foreach($result AS $row) {
      echo var_dump($row);
  };
  </code></pre>
  <hr />
  <p>Now my problem is that I get an array of two values in my browser for each <code>$row</code>, even though I am only asking to return <code>id</code>:</p>
  <blockquote>
  <p>array(2) { [&quot;id&quot;]=&gt; string(3) &quot;GNQ&quot; [0]=&gt; string(3) &quot;GNQ&quot; }</p>
  </blockquote>
  <p>So somehow I am getting a second value, again with the <code>id</code> but with a different key identifier (in that case the index). What am I doing wrong here?</p>