title: Compare Two Strings in MySQL
body: <p>My current query (doesn't work)</p>
  
  <pre><code>SELECT url
  FROM table
  WHERE
      'http://www.longurl.com/some/string' like '%' . url . '%'
  </code></pre>
  
  <p>table</p>
  
  <pre><code>url
  longurl.com
  </code></pre>
  
  <p>I am trying to match the record in "table" for longurl.com to any compared URL that contains longurl.com.</p>
  
  <p>Should match compared URLs such as:</p>
  
  <pre><code>http://www.longurl.com/some/string
  http://longurl.com
  http://longurl.com/some/string
  </code></pre>
  
  <p>In this PHP example, it is very easy to compare:</p>
  
  <pre><code>$url = "http://www.longurl.com/some/string";    
  if(strstr($url, 'longurl.com')) {
      echo "success";
  } else {
      echo "failure";
  }
  </code></pre>