The sql_in()
function is used to create a column condition using the IN
SQL keyword.
It employs 5 parameters:
-
$val
is the name of the column, -
$valeurs
is 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
, -
$not
is used to provide negation. By default it is empty''
; assign'NOT'
to execute aNOT IN
condition, -
$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)) {
// ...
}