title: PHP / MySql: How to store Select results in temporary array to fetch single items from there
body: <p>I am a complete beginner to PHP and MySQL and hope someone can help me with this. </p>
  
  <p>I have a MySql db with a table "<code>TranslationsMain</code>" and the following PHP query. 
  This returns all the items from column "<code>en</code>" in the db table and works correctly so far. </p>
  
  <p>Instead of echoing the whole list (I just did this here for testing), <strong>how can I echo only a specific item from the column resp. from the query results</strong>, e.g. the fifth item ?
  I could also add an ID column for this to my db table if that helps.</p>
  
  <p><strong>Note:</strong> 
  The login variables to establish the connection are declared separately in my header file. </p>
  
  <p><strong>My PHP:</strong> </p>
  
  <pre><code>&lt;?php 
      require_once("includes/header.php");
  
      $tblTranslations = "TranslationsMain";  
  
      $conn = new mysqli($servername, $username, $password, $dbname);
      if($conn-&gt;connect_error){
          die("Connection failed: " . $conn-&gt;connect_error);
      } 
      $sql = "SELECT * FROM " . $tblTranslations;
      $translations = $conn-&gt;query($sql);
      if($translations-&gt;num_rows &gt; 0){
          echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;Translations&lt;/th&gt;&lt;/tr&gt;";
          while($translation = $translations-&gt;fetch_assoc()){
              echo "&lt;tr&gt;&lt;td&gt;" . $translation["en"] . "&lt;/td&gt;&lt;/tr&gt;";
          }
          echo "&lt;/table&gt;";
      }else{
          echo "0 results";
      }
      $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p><strong>Update:</strong><br>
  This is not a duplicate of the other question posted in the comments. 
  What I am looking for here is a way to fetch all data at once on page load and save it temporarily so that I can then just refer to the temporary storage from within the page instead of having to call the db multiple times.<br>
  <strong>A possible solution could be map / key (see Goikiu's comment below).</strong></p>
  
  <p>Many thanks in advance, 
  Mike</p>