Filter php chebox

Asked

Viewed 65 times

1

function parseMysqlQuery($array) {

$output = ''; foreach( $array as $key => $value){

   $output .= !$output ? " WHERE $table.$key " : " AND $table.$key";
   $output .= ' IN ("' . implode('","', $value) . '")';
}
echo "Key: $key; Value: $value<br />\n";
return $output;
}

$array = (array)filter_input_array(INPUT_POST, array( "num" => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FORCE_ARRAY, ),

'grupo' => array(
    'filter' => FILTER_SANITIZE_STRING,
    'flags'  => FILTER_FORCE_ARRAY,
),

'dt_de_inducao' => array(
    'filter' => FILTER_SANITIZE_STRING,
    'flags'  => FILTER_FORCE_ARRAY,
),
));

//SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = 'folha_tarefa' if ($_SERVER['REQUEST_METHOD'] == "POST") { $array = array_filter($array);

$in = parseMysqlQuery($array);

$query = "SELECT * FROM contratos " . $in;

This is a filter with checkbox, only I have a search that I do a Join left and I’m not getting my php to understand which table to search, ex nometable.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.