title: how to derive id of a particular element that is part of a string in column in mysql table
body: <p>This is my table services</p>
  
  <pre><code>id      servicename
  901     cleaning
  902     washing
  903     cooking
  904     repair
  </code></pre>
  
  <p>This is another table payment </p>
  
  <pre><code>customerid      package_details
  9088                cleaning,washing
  9099                washing,cleaning,repair
  9010                cooking,repair,washing
  </code></pre>
  
  <p>I have tried something like this in php to select id for particular service that the customer opted</p>
  
  <pre><code>$id=$_REQUEST['id'];
  $q1= array();
  $q2=array();
      $stmti=$db-&gt;prepare("SELECT package_details FROM `payment` WHERE customerid=?");
        $stmti-&gt;bind_param("s",$id);
        $stmti-&gt;execute();
  $stmti-&gt;bind_result($package);
  
  while ($stmti-&gt;fetch()) {
    $q1=explode(",",$package);
  for ($i=0; $i &lt;sizeof($q1) ; $i++) {
  
    $query=$db-&gt;prepare("SELECT `id` FROM `services` WHERE servicename=?");
    $query-&gt;bind_param("s",$q1[$i]);//error here
    $query-&gt;execute();
    $query-&gt;bind_result($pid);
    while ($query-&gt;fetch()) {
      $q2[$i]=$pid;
    }
  }
  
  }
  </code></pre>
  
  <p>I am getting error in the line having comment above the error is 
  Call to a member function bind_param() on boolean 
  Is there any method to achieve so? with php or only with mysql?</p>