I have MySQLi Query Like below
$seluser = "SELECT * FROM player_table WHERE game_type = '$gameType' AND table_status = 'L' AND game = '$game'";
if ($playerCapacity != '') {
$seluser = $seluser . " AND player_capacity = $playerCapacity" ;
}
if ($fromPoints != '') {
$seluser = $seluser . " AND min_entry >= $fromPoints" ;
}
if ($toPoints != '') {
$seluser = $seluser . " AND min_entry <= $toPoints" ;
}
if ($poolType != '') {
$seluser = $seluser . " AND pool = '$poolType'" ;
}
if ($gameType == 'Point Rummy') {
$seluser = $seluser . " group by min_entry,player_capacity ORDER BY point_value ASC" ;
} else {
$seluser = $seluser . " group by min_entry,player_capacity,pool ORDER BY min_entry ASC" ;
}
$runuser = mysqli_query($connect,$seluser) or die(mysqli_error($connect));
$total = mysqli_num_rows($runuser);
It's working fine but I am looking for migrate this to prepared statement. I am getting idea how I can join first parameter of bind_param, but since second parameter will be PHP variables, so I am not getting idea how I can manage it.