title: Select every item in a SQL column into an array, PHP
body: <p>I've hit a little wall in something I'm trying to do.</p>
  
  <p>I have a table, entitled 'projects', in a database in SQL.</p>
  
  <p>My issue is that I can't seem to select every row in a specific column.</p>
  
  <p>This is the code that I've got so far relevant to this question (keep in mind that '$conn' is the connection to the SQL database, and the include command on the second line is just to include that connection):</p>
  
  <pre><code>            //CONNECTION FILE   
          include "../include/dbh-inc.php";
          //ASSIGNING QUERY VALUES TO VARIABLES
          $q1 = mysqli_query($conn,"SELECT pid FROM projects;");
          $q2 = mysqli_query($conn,"SELECT ptitle FROM projects;");
          $q3 = mysqli_query($conn,"SELECT plink FROM projects;");
          //SETTING ARRAYS FROM VARIABLES
          $ids = mysqli_fetch_array($q1);
          $titles = mysqli_fetch_array($q2);
          $links = mysqli_fetch_array($q3);
  
          mysqli_close($conn);
          file_put_contents("newtest.txt","$titles\n");
          foreach($titles as $title) {
              file_put_contents("newtest.txt","$title\n", FILE_APPEND); //Testing
          }
          if(count($ids) &gt; 0) {
              file_put_contents("TEST.txt","");
              for($i = 0; $i &lt; count($ids)-1; $i+=1) {            
                  $count = count($ids);
                  $title = $titles[$i];
                  $id = $ids[$i];
                  $link = $links[$i];
                  file_put_contents("TEST.txt","$i: $title, $id ($count), $link\n",FILE_APPEND);
                  echo("
                  &lt;div class=\"projlink\"&gt;
                  &lt;a href=\"$link\" style=\"width:190px;height:90px\"&gt;
                  &lt;h2&gt;$title&lt;/h2&gt;
                  &lt;/a&gt;
                  &lt;/div&gt;
                  ");
  
              }
          }
          else {
              echo("
                  &lt;h2&gt;Nothing here currently!&lt;br&gt;Be patient!&lt;/h2&gt;
              ");
          }
  </code></pre>
  
  <p>Any thoughts?</p>
  
  <p>Thanks!
  - Raphael</p>