title: mysqli display data based on row ID value
body: <p>I need to display an text in an row, based on an value from other table, I will explain... step by step to be all very CLEAR.</p>
  
  <p>The table called "links" have an row called "title_id"</p>
  
  <p>This row "title_id" from "links", have THE SAME value in other table called "titles" in the row named "id".</p>
  
  <p>The table "titles" have another row called "title" - and tis is wath i need to display in this way...</p>
  
  <p>a href= ..../>TABLE links row title_id = to TABLE titles row id -> DISPLAY HERE table titles row title (based on row title_id from the table links) &lt; /a...</p>
  
  <p>I hope you can understand, the result must be (a href=...>TEXT MOVIE TITLE&lt; /a>)</p>
  
  <p>Here is the base code, wath I need to change (I have commented the part wath need changes):</p>
  
  <pre><code>    &lt;?php
      $servername = "localhost";
      $username = "username";
      $password = "password";
      $dbname = "dbname";
  
      // Create connection
      $conn = new mysqli($servername, $username, $password, $dbname);
      // Check connection
      if ($conn-&gt;connect_error) {
          die("Connection failed: " . $conn-&gt;connect_error);
      } 
  
      $sql = "SELECT id, label, title_id, season, episode, approved FROM links WHERE approved = 1 order by id desc LIMIT 30 OFFSET 1";
      $result = $last_id = $conn-&gt;query($sql);
  
  
      if ($result-&gt;num_rows &gt; 0)
       {
          echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;&lt;th&gt;Audio&lt;/th&gt;&lt;th&gt;URL&lt;/th&gt;&lt;th&gt;Temporada&lt;/th&gt;&lt;th&gt;Episodio&lt;/th&gt;&lt;th&gt;Aprobado&lt;/th&gt;&lt;/tr&gt;";
          // output data of each row
          while($row = $result-&gt;fetch_assoc()) {
              echo "&lt;tr&gt;&lt;td&gt;".$row["id"]."&lt;/td&gt;&lt;td&gt;".$row["label"]."&lt;/td&gt;";
              echo "&lt;td&gt;";
              if (empty($row['episode'])) {
           echo "&lt;a href=";
           echo '/peliculas-online/'.$row["title_id"];
           echo "&gt;HERE MUST HAVE THE VALUE FROM TABLE titles -&gt; row title - based on $row["title_id"] &lt;/a&gt;";
  // -------------------------
          }
          else {
          echo "&lt;a href=";
           echo '/series-online/'.$row['title_id'].'/seasons/'.$row['season'].'/episodes/'.$row["episode"];
           echo "&gt;HERE MUST HAVE THE VALUE FROM TABLE titles -&gt; row title - based on $row["title_id"] &lt;/a&gt;";
  // -----------------------------------
              }
              echo "&lt;/td&gt;";
              echo "&lt;td&gt;".$row["season"]."&lt;/td&gt;&lt;td&gt;".$row["episode"]."&lt;/td&gt;&lt;td&gt;".$row["approved"]."&lt;/td&gt;&lt;/tr&gt;";
  
  
          }
          echo "&lt;/table&gt;";
      } else {
          echo "0 results";
      }
      $conn-&gt;close();
      ?&gt;
  </code></pre>