title: Fetching correct row depending on column value
body: <p>I need help figuring out how to fetch the correct row, depending on the rows column value but by only making one query. I want an array to store all rows, but then fetch the right value from the array.</p>
  
  <p>This is how my table is structured:</p>
  
  <pre><code>ID  Name    Text    Page
  </code></pre>
  
  <p>Using an PHP Array, I want to echo <code>text</code> depending on what the value of <code>name</code> on that key is.<br>
  This is my PHP code to fetch the table:</p>
  
  <pre><code>&lt;?php
      $db = mysqli_connect(DB_HOST,DB_USR,DB_PASS,DB_NAME);
      $db-&gt;set_charset("utf8mb4");
  
      $result = mysqli_query($db, "SELECT * FROM content WHERE Page='index';");
      $row = mysqli_fetch_assoc($result);
  
      mysqli_close($db);
  ?&gt;
  </code></pre>
  
  <p>I tried this, but for obvious reasons it didn't really work:</p>
  
  <pre><code>&lt;h1&gt;&lt;?php if($row['Name'] == 'slide_1_title') echo $row['Text']; ?&gt;&lt;/h1&gt;
  </code></pre>
  
  <p>I would gladly appreciate someone helping me out on this one. How can I solve this?</p>