title: Add a variable inside a mysql query
body: <p>I have a variable <code>$text = "sometexthere"</code></p>
  
  <p>I would like to add this variable <code>$text</code> inside the following mysql query instead of <code>sometexthere</code></p>
  
  <p><code>$query = "SELECT sum(nbr) AS sum FROM table2 WHERE name LIKE '%sometexthere%'";</code></p>
  
  <p>I tried doing that in many ways like</p>
  
  <p><code>$query = "SELECT sum(stats) AS sum FROM download WHERE filename LIKE '%' . $text . '%'";</code></p>
  
  <p>and</p>
  
  <pre><code>$name = "'%' . $text . '%'";
  $query = 'SELECT sum(stats) AS sum FROM download WHERE filename LIKE '.$name.'';
  </code></pre>
  
  <p>But not working :/</p>