Dbal.sql in set
From phpBB Development Wiki
dbal::sql_in_set –– Builds in set string for use within an sql_query.
Contents |
Description
string sql_in_set ( String $column , Array $array [, Bool $negate [, Bool $allow_empty_set ]] )
Builds IN, NOT IN, = and <> sql comparison string. Defined in dbal class.
Parameters
| Parameter | Usage |
|---|---|
| column | Name of the sql column that shall be compared. |
| array | Array of values that are allowed (IN) or not allowed (NOT IN). |
| negate (Optional) | true for NOT IN (), false for IN () (default). |
| allow_empty_set (Optional) | If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. |
Return Values
Returns a string to be used in the WHERE clause of an SQL Query
Examples
Example #1
$sql_in = array(2, 58, 62);
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $sql_in);
See Also

