[insert_php]
header(“Content-Type: text/html; charset=UTF-8”);
error_reporting(-1);
ini_set(‘display_errors’, ‘On’);
$config = array();
$config[‘host’] = ‘192.168.33.49’;
$config[‘user’] = ‘web247’;
$config[‘pass’] = ‘Vj247Sel’;
$config[‘db’] = ‘ZAM’;
$conn = mssql_connect($config[‘host’], $config[‘user’], $config[‘pass’]) or die(mssql_get_last_message());
mssql_select_db($config[‘db’]) or die(mssql_get_last_message());
function query($s)
{
$res = mssql_query($s) or die(mssql_get_last_message());
return $res;
}
function show_results($res, $columns=false)
{
echo “
“; if ($columns && $columns[$i]) { echo(htmlspecialchars($columns[$i])); } else { echo(htmlspecialchars(mssql_field_name($res, $i))); } echo “ |
“; echo(htmlspecialchars($row[$i])); echo “ |
“;
}
query(“set language Czech”);
$res = query(“select ROW_NUMBER() over (order by dbpocetvyst desc) as poradi,dbPocetVyst,dbOsobniCislo,dbJmeno,dbObec,dbRokNar,dbVek,dbFunkce from WvjPristupy247countVekLoni where right(dbFunkce,3)=’ena’ and dbVek <30");
show_results($res, ["poradi","pocet vystupu", "osobni cislo", "jmeno", "obec", "rok narozeni","vek", "pohlavi"]);
$res = query("select ROW_NUMBER() over (order by dbpocetvyst desc) as poradi,dbPocetVyst,dbOsobniCislo,dbJmeno,dbObec,dbRokNar,dbVek,dbFunkce from WvjPristupy247countVekLoni where right(dbFunkce,3)='ena' and dbVek >=30″);
show_results($res, [“poradi”,”pocet vystupu”, “osobni cislo”, “jmeno”, “obec”, “rok narozeni”,”vek”, “pohlavi”]);
$res = query(“select ROW_NUMBER() over (order by dbpocetvyst desc) as poradi,dbPocetVyst,dbOsobniCislo,dbJmeno,dbObec,dbRokNar,dbVek,dbFunkce from WvjPristupy247countVekLoni where right(dbFunkce,3)<>‘ena’ and dbVek <40");
show_results($res, ["poradi","pocet vystupu", "osobni cislo", "jmeno", "obec", "rok narozeni","vek", "pohlavi"]);
$res = query("select ROW_NUMBER() over (order by dbpocetvyst desc) as poradi,dbPocetVyst,dbOsobniCislo,dbJmeno,dbObec,dbRokNar,dbVek,dbFunkce from WvjPristupy247countVekLoni where right(dbFunkce,3)<>‘ena’ and dbVek >=40″);
show_results($res, [“poradi”,”pocet vystupu”, “osobni cislo”, “jmeno”, “obec”, “rok narozeni”,”vek”, “pohlavi”]);
[/insert_php]