This is my table services
id servicename
901 cleaning
902 washing
903 cooking
904 repair
This is another table payment
customerid package_details
9088 cleaning,washing
9099 washing,cleaning,repair
9010 cooking,repair,washing
I have tried something like this in php to select id for particular service that the customer opted
$id=$_REQUEST['id'];
$q1= array();
$q2=array();
$stmti=$db->prepare("SELECT package_details FROM `payment` WHERE customerid=?");
$stmti->bind_param("s",$id);
$stmti->execute();
$stmti->bind_result($package);
while ($stmti->fetch()) {
$q1=explode(",",$package);
for ($i=0; $i <sizeof($q1) ; $i++) {
$query=$db->prepare("SELECT `id` FROM `services` WHERE servicename=?");
$query->bind_param("s",$q1[$i]);//error here
$query->execute();
$query->bind_result($pid);
while ($query->fetch()) {
$q2[$i]=$pid;
}
}
}
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?