title: How do I make a clickable url in my php page after getting data from MySQL DB?
body: <p>I'm trying to pull data from 1 column of a db and making it into a link where the URL is being pulled from another column. Unfortunately, I have not been able to do this. I've attached the screenshot of the output here's the code I'm using:</p>
  
  <pre><code>$sql = "SELECT DISTINCT item_title, item_url, item_date, item_author FROM nbth";
   $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
  // output data of each row
  while($row = $result-&gt;fetch_assoc()) {
      echo "&lt;a&gt;" . $row["item_title"]. " url: " . $row["item_url"]. " &lt;br&gt; - By " . $row["item_author"] . " " . $row["item_date"]. "&lt;br&gt;&lt;br&gt;&lt;/a&gt;" ;
      $HTML .= "&lt;a href=".$row['item_url']."&gt;".$row['item_title']."&lt;/a&gt;";
      echo $HTML;
  }
  } else {
  echo "0 results";
  }
  </code></pre>
  
  <p>Screenshot of the results:
  [![enter image description here][1]][1]</p>
  
  <p>The titles do become links but the get looped again and again, the first title in the first line, then next the first title and second, then the first, second and third, so on and so forth. So, how do I fix this looping and still display the titles as links.</p>