In
In
The steps to use the sql IN property with a where condition using ivory just involves a few properties more.
Example
//import the ivory class
require_once('Operations.php');
//the instance of the ivory
$ivoryOrm = new Operations();
$arrSelect[] = "name";
$arrSelect[] = "email";
$inSelect[] = "Jon"
$inSelect[] = "James"
$inSelect[] = "Jasmine"
$tables[] = "users";
$arrWhere[] = [
"propName" => "name",
"fieldValue" => "",
"isIn" => $inSelect,
];
//the method select creates the query : SELECT name,email FROM users WHERE name IN ('Jon', 'James', 'Jasmine');
$select = $ivoryOrm->select($arrSelect, $tables);
$selectWhere = $ivoryOrm->where($select, $arrWhere);
//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($selectWhere);
Example SELECT IN
//import the ivory class
require_once('Operations.php');
//the instance of the ivory
$ivoryOrm = new Operations();
$arrSelect[] = "name";
$arrSelect[] = "email";
$inSelect[] = "name"
$tables[] = "users";
$selectIn = $ivoryOrm->select($inSelect, $tables);
$arrWhere[] = [
"propName" => "name",
"fieldValue" => "",
"isIn" => $selectIn,
];
//the method select creates the query : SELECT name,email FROM users WHERE name IN (SELECT name FROM users);
$select = $ivoryOrm->select($arrSelect, $tables);
$selectWhere = $ivoryOrm->where($select, $arrWhere);
//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($selectWhere);