//connection
$conn_string = "host=/var/run/postgresql dbname=prao user=www-prao";
$db = pg_connect($conn_string);
if($db) {
$idN = $_GET['idD'];
if(!is_numeric($idN)) die("Неверное значение id!");
$query = "SELECT name_div, name_head FROM division WHERE id='$idN'";
$result = pg_exec($db, $query);
$numb = pg_numrows($result);
$rowFromTable = pg_fetch_array($result);
$nameDiv = $rowFromTable["name_div"];
$nameHead = $rowFromTable["name_head"];
$query = "SELECT name, post, name_lab, laboratory.name_head as lab_head
FROM staff, laboratory
WHERE staff.div_id = '$idN' AND laboratory.id = staff.lab_id
ORDER BY name_lab, name";
$result = pg_exec($db, $query);
//print " numb = $numb
";
$rowFromTable = pg_fetch_array($result);
} else {
print "Can't create connection
";
exit;
}
?>
|
|
|
|
echo $nameDiv ?> |
if(!empty($nameHead)) { ?>
Руководитель: echo $nameHead ?> |
} ?>
$fl_table=0;
$nameL="";
while (is_array($rowFromTable)) {
$name = $rowFromTable["name"];
$post = $rowFromTable["post"];
$name_lab = $rowFromTable["name_lab"];
$lab_head = $rowFromTable["lab_head"];
if (!empty($name_lab) AND ($name_lab!="no laboratory")) {
if($name_lab == $nameL) {
echo " | ";
echo " ". $name ." | ";
echo " ". $post ." | ";
echo " ";
} else {
$nameL = $name_lab;
if($fl_table=="1") {
echo " ";
$fl_table=0;
}
echo "";
echo " ";
if(empty($lab_head)) {
echo " ".$name_lab." | ";
} else {
echo " ".$name_lab." Зав. лабораторией: ".$lab_head ." | ";
}
echo " ";
echo " ";
echo "";
echo " ";
echo " ". $name ." | ";
echo " ". $post ." | ";
echo " ";
$fl_table=1;
}
} else {
if($fl_table=="0") {
$fl_table = 1;
echo "";
}
echo "";
echo " ". $name ." | ";
echo " ". $post ." | ";
echo " ";
}
$rowFromTable=pg_fetch_array($result);
}
pg_close($db);
if($fl_table == "1") {
echo " ";
}
?>
|
|
|
|
|
|
Copyright 2005 - 2008, ВТИТ home@prao.ru |