<?php

require('../codebase/connector/combo_connector.php');
require("../codebase/connector/db_mysqli.php");
 
 $res = db ();

if ( !$res)
    echo "NO ESTOY CONECTADO"; 

$res->query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");

$combo = new ComboConnector($res,"MySQLi");


$quer = "SELECT CONCAT( '|', t2.NameLast, ', ', t2.NameFirst ,  ' [' ,  SUBSTRING(t1.position,1,1), ']:', t2.id , '|') as value, ";
$quer = $quer . " t2.NameFirst";
$quer = $quer . " FROM organizationPersons t1, persons t2 WHERE t1.personId = t2.id ";
$quer = $quer . " AND t1.active = 1 AND organizationId = '1' ";

$combo->render_sql($quer,"NameFirst","NameFirst(value),NameFirst(label)");


function db () {
    static $conn;
    if ($conn===NULL){ 
        $conn = new mysqli('localhost','orkindb','rmschpsw1','rmscheduler_orkincr'); 
        $conn->set_charset("utf8");
    }
    return $conn;
}

?>
 