The sql_in() function is used to create a column condition using the IN SQL keyword.
It employs 5 parameters:
-
$valis the name of the column, -
$valeursis the list of values, in the form of an array or a comma-separated sequence of strings. These values will be automatically filtered usingsql_quote, -
$notis used to provide negation. By default it is empty''; assign'NOT'to execute aNOT INcondition, -
$serveur, -
$option.
It can be used as follows:
$vals = array(2, 5, 8);
// where $vals = "2, 5, 8";
$in = sql_in('id_table', $vals);
if ($res = sql_select('column', 'table', $in)) {
// ...
}