title: Join query based on existence of anchor tag?
body: <p>For the sake of ease, I simplified the script below. </p>
  
  <p><strong>TABLE: users</strong></p>
  
  <pre><code>id   |  username     | location
  
  12   |  best_chef    |  SF, CA
  15   |  muffin_girl  | Miami, FL
  </code></pre>
  
  <p><strong>TABLE: list</strong></p>
  
  <pre><code>post_id   |  userid  |  post
  
    95      |   15     |  check out my new recipe!
    96      |   12     |  I love &lt;a href="profile.php?id=$12"&gt;best_chef&lt;/a&gt; 's recipes 
  </code></pre>
  
  <p>Here's the <strong>SQL query</strong> i'm using to display posts:</p>
  
  <p><code>$table = query("SELECT id, post, post_id, username FROM list, users WHERE list.userid = users.id");</code></p>
  
  <p><strong>HTML:</strong>   </p>
  
  <pre><code>&lt;div class="update"&gt;
     &lt;div class="user"&gt;&lt;?php echo $usermame ?&gt;&lt;/div&gt;  //"muffin_girl"
     &lt;div class="post"&gt;&lt;?php echo $post ?&gt;&lt;/div&gt;     // "i love best_chef's recipes"       
  &lt;/div&gt;
  </code></pre>
  
  <p>What I am trying to do is to add a <strong>popup box that will display the location of the person tagged</strong> in a post WHEN the anchor of the post is hovered. Something like that:</p>
  
  <pre><code> &lt;div class="popup"&gt;&lt;?php echo location ?&gt;&lt;/div
  </code></pre>
  
  <p><strong>Question:</strong> </p>
  
  <p>How can I <strong>join the anchor tag of the posts with the location of the users</strong>? Plus, not all posts contain an anchor tag.</p>
  
  <p>Would this be feasible? i have a feeling i'm overthinking this.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Desired output/pseudocode:</p>
  
  <p><code>$sql = "SELECT post, username, location FROM list, users WHERE post like '%{TODO:anchor text}%' = users.username LIMIT 1";</code></p>