Multiple select checkbox fetch select Mysql query IN clause select Multiple checkbox fetching data

Description

Multiple checkbox search query fetching data from database in php, Multiple select checkbox fetch select Mysql query. used IN clause in mysql if I select two or more check box and featch data in single query  mysql 

 

if condition : if I select choose or click on one option from the search select box I get data in single query 

2nd condition : if I select two or more check box and featch data in single query  mysql

 

If i select one or multiple check box fetch all data in single mysql query 

 

<?php

if(!empty($_GET['check_list'])) {

$chk="";

    foreach($_GET['check_list'] as $check) {

 // echo $check; //echoes the value set in the HTML form for each checked checkbox.

     //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5.

        //in your case, it would echo whatever $row['Report ID'] is equivalent to.

// echo $check . ",";

$chk .= "'" . $check."', ";

//echo $check_e; 

//$chk .= $chk1 . ","; 

//$value = $check; 

    }

$check_e = rtrim($chk,", ");

//echo $check_e;

//last comma remove function

}

echo $check_e;

?>

Mysql 

select * from table where codelist IN($check_e) ORDER BY id DESC