title: SQL parameterized query with LIKE '% ? %' PHP
body: <p>I have a Search function in php and have created it using a parameterized query to make it secure.<br><br></p>
  
  <pre><code>$words = $_POST['words']//words is the form that has the words submitted by the user 
  $array = explode(',', $words);
  $con = mysqli_connect("localhost","user","pass","database");
  
  $stmt = $con-&gt;prepare(" SELECT column_name FROM table WHERE column_name LIKE ?")
  foreach($array as $key) { //searches each word and displays results   
    $stmt-&gt;bind_param('s', $key)
    $stmt-&gt;execute();
    $result = $stmt-&gt;get-result();
  
    while($row = $result-&gt;fetch_assoc(){
      echo $row["column_name"]
    }
  }
  </code></pre>
  
  <p>however I want <strong>$stmt</strong> statement to be </p>
  
  <pre><code>  $stmt = $con-&gt;prepare(" SELECT column_name FROM table WHERE column_name LIKE '%?%' ")
  </code></pre>
  
  <p>otherwise people have to type in the entire value of column_name to find it.</p>