Полезное:
Как сделать разговор полезным и приятным
Как сделать объемную звезду своими руками
Как сделать то, что делать не хочется?
Как сделать погремушку
Как сделать так чтобы женщины сами знакомились с вами
Как сделать идею коммерческой
Как сделать хорошую растяжку ног?
Как сделать наш разум здоровым?
Как сделать, чтобы люди обманывали меньше
Вопрос 4. Как сделать так, чтобы вас уважали и ценили?
Как сделать лучше себе и другим людям
Как сделать свидание интересным?
Категории:
АрхитектураАстрономияБиологияГеографияГеологияИнформатикаИскусствоИсторияКулинарияКультураМаркетингМатематикаМедицинаМенеджментОхрана трудаПравоПроизводствоПсихологияРелигияСоциологияСпортТехникаФизикаФилософияХимияЭкологияЭкономикаЭлектроника
|
ПРИЛОЖЕНИЕ 2. Листинг файла «functions.php»⇐ ПредыдущаяСтр 21 из 21
Листинг файла «functions.php» <?php define ("HOST_DB", "localhost");define ("DB_USER", "user");define ("DB_PASS", "pass");define ("DB_NAME", "database"); function getinfo($sql){$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){$data[].= $fieldValue;}}$result->close();$mysqli->close();return $data;};function execute($sql){$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$mysqli->query($sql);$mysqli->close();return 1;} function get_all_id_students(){$sql='SELECT `id` FROM `students`';return (getinfo($sql));}function get_all_id_groups(){$sql='SELECT `id` FROM `group`';return (getinfo($sql));} function get_all_id_lectures(){$sql='SELECT `id` FROM `lectures`';return (getinfo($sql));} function all_info_students(){$ids=get_all_id_students();foreach($ids as $id){ echo "<tr>"; $sql="SELECT `id`, `Surname`,`Name`,`Patronymic`,`Specialty`,`Entered`,`group_id`, `N_zach` FROM `students` where `id`=$id"; $mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql); foreach($result->fetch_assoc() as $key => $value){if($key=="Specialty")$value=get_spec_name ($value);if($key=="group_id")$value=get_group($value);echo "<td><div align=\"center\">$value</div></td>";} $result->close();$mysqli->close(); echo " <td><div align=\"center\"><a href=\"students.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"\></a></div></td><td><div align=\"center\"><a href=\"edit_students.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></div></td></tr>"; };} function all_info_groups(){$ids=get_all_id_groups();foreach($ids as $id){echo "<tr>";$sql="SELECT `id`, `name`,`year`,`group_number` FROM `group` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);foreach($result->fetch_assoc() as $key => $value){echo "<td><div align=\"center\">$value</div></td>";}$result->close();$mysqli->close();echo "<td><div align=\"center\"><a href=\"groups.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"\></a></div></td><td><div align=\"center\"><a href=\"edit_groups.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></div></td> </tr>";};}function get_name_group_full($id){$sql="SELECT `name`,`year`,`group_number` FROM `group` where `id`=$id";$group=getinfo($sql);$group=$group[0].$group[1].$group[2];return $group;} function all_info_lectures(){$ids=get_all_id_lectures();foreach($ids as $id){echo "<tr>";$sql="SELECT `id`, `Surname`,`Name`,`Patronymic`,`Stepen_id`,`Departmen_id`,`items_id` FROM `lectures` where `id`=$id"; $mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);foreach($result->fetch_assoc() as $key => $value){if($key=="Stepen_id")$value=get_stepen_name ($value);if($key=="Departmen_id")$value=get_kaf_name ($value);if($key=="items_id")$value=get_items_name ($value);echo "<td><div align=\"center\">$value</div></td>"; } $result->close();$mysqli->close(); echo "<td><div align=\"center\"><a href=\"lectures.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"\></a></div></td><td><div align=\"center\"><a href=\"edit_lectures.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></div></td></tr>";};} function get_all_info_spec(){ $count= getinfo("SELECT count(`id`) from `spec");$count=$count[0];$sql="SELECT `id`, `Name` from `spec`";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);for($k=1; $k<=$count; $k++){ foreach($result->fetch_assoc() as $key => $value){if($key=="id")$id=$value;if($key=="Name")$Name=$value;ПРОДОЛЖЕНИЕ ПРИЛОЖЕНИЯ 2if(($id)&&($Name)) {echo "<tr><td>".$id."</td><td>$Name</td><td><a href=\"spec.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"></a></td><td><a href=\"edit_spec.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></td></tr>";$id=""; $Name="";};};};$result->close();$mysqli->close();} function get_all_info_predm(){ $count= getinfo("SELECT count(`id`) from `predm");$count=$count[0];$sql="SELECT `id`, `Name` from `predm`";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);for($k=1; $k<=$count; $k++){foreach($result->fetch_assoc() as $key => $value){if($key=="id")$id=$value;if($key=="Name")$Name=$value;if(($id)&&($Name)) {echo "<tr><td>".$id."</td><td>$Name</td><td><a href=\"predm.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"></a></td><td><a href=\"edit_predm.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></td></tr> ";$id=""; $Name="";};};}; $result->close();$mysqli->close();} function id_info_lectures($kaf){$ids=getinfo("SELECT `id` FROM `lectures` where `Departmen_id`=$kaf");foreach($ids as $id){ echo "<tr>";if($kaf) $sql="SELECT `id`, `Surname`,`Name`,`Patronymic`,`Stepen_id`,`Departmen_id`,`items_id` FROM `lectures` where `Departmen_id`=$kaf and id=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);foreach($result->fetch_assoc() as $key => $value){if($key=="Stepen_id")$value=get_stepen_name ($value);if($key=="Departmen_id")$value=get_kaf_name ($value);if($key=="items_id")$value=get_items_name ($value);echo "<td><div align=\"center\">$value</div></td>";$value="";} $result->close();$mysqli->close(); if(!$kaf)echo "<td><div align=\"center\"><a href=\"lectures.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"\></a></div></td><td><div align=\"center\"><a href=\"lectures.php?act=edit&id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></div></td></tr>";};} function get_all_kaf_li(){$ids=get_all_kaf_id();foreach($ids as $id){echo "<li><a href=\"personal-kaf-prep.php?kaf=$id\">". get_kaf_name($id)."</li>";}}function get_all_predm_li(){$ids=get_all_predm_id();foreach($ids as $id){echo "<li><a href=\"personal-kaf-prep.php?kaf=$id\">". get_kaf_name($id)."</li>";}} function get_all_predm_li_ved(){$ids=get_all_predm_id();foreach($ids as $id){echo "<li><a href=\"ved_predm.php?predm=$id\">". get_predm_name($id)."</li>";}} function get_all_group_li_a(){$ids=get_group_id();foreach($ids as $id){echo "\n<li><a href=\"vedomost_group.php?group=$id\">". get_group_name($id).get_group_number($id).get_group_year($id)."</li>";}}function get_all_kaf_dep(){$count=getinfo("SELECT count(`id`) from `Departments`");$count=$count[0];$sql="SELECT `id`, `Name`, `ZavDepartment` from `Departments`";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql); for($k=1; $k<=$count; $k++){foreach($result->fetch_assoc() as $key => $value){if($key=="id")$id=$value;if($key=="Name")$Name=$value;if($key=="ZavDepartment")$zav=$value;if(($id)&&($Name)&&($zav)) {echo "<tr><td>".$id."</td><td>$Name</td><td>$zav</td><td><a href=\"department.php?act=del&id=$id\" title=\"Удалить\"><img src=\"del.png\"></a></td><td><a href=\"edit_department.php?id=$id\" title=\"Редактировать\"><img src=\"edit.png\"></a></td></tr>"; $id=""; $Name=""; $zav="";};};};$result->close();$mysqli->close();return $data;} function del_student($id){$sql="DELETE FROM `students` where `id`=$id";execute($sql);return 1;} function del_group($id){$sql="DELETE FROM `group` where `id`=$id";execute($sql);return 1;} function del_lectures($id){$sql="DELETE FROM `lectures` where `id`=$id";execute($sql);return 1;} function del_kaf($id){$sql="DELETE FROM `Departments` where `id`=$id";execute($sql);return 1;}function del_spec($id){$sql="DELETE FROM `spec` where `id`=$id";execute($sql);return 1;}function del_predm($id){$sql="DELETE FROM `predm` where `id`=$id";execute($sql);return 1;} function get_all_kaf_id(){$sql='SELECT `id` FROM `Departments`';return (getinfo($sql));} function get_all_predm_id(){$sql='SELECT `id` FROM `predm`';return (getinfo($sql));}function get_all_spec_id(){$sql='SELECT `id` FROM `spec`';return (getinfo($sql)); }function get_all_group_id(){$sql='SELECT `id` FROM `group`';return (getinfo($sql));} function get_all_stud_id(){$sql='SELECT `id` FROM `students`';return (getinfo($sql));} function get_all_stepen_id(){$sql='SELECT `id` FROM `stepeni`';return (getinfo($sql));} function get_predm_ved($predm){echo "<tr>";$sql="SELECT `id`, `id_stud`,`id_pred`,`ocenka` FROM `vedomosti` where `id_pred`=$predm";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);foreach($result->fetch_assoc() as $key => $value){if($key=="id_stud")$value=get_fio_student ($value);if($key=="id_pred")$value= get_predm_name ($value);echo "<td><div align=\"center\">$value</div></td>";}$result->close(); $mysqli->close();echo "</tr>";}function get_fio_student($id){$sql="SELECT `Surname` FROM `students`";$x=getinfo($sql);$fio.=$x[0];$sql="SELECT `Name` FROM `students`";$x=getinfo($sql);$fio.=' '.$x[0];$sql="SELECT `Patronymic` FROM `students`";$x=getinfo($sql);$fio.=" ".$x[0];return $fio;} function get_all_kaf_sel(){$ids=get_all_kaf_id();echo "<option disabled>Выберите кафедру</option>";foreach($ids as $id){$sql="SELECT `Name` FROM `Departments` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){echo "<OPTION value=\"$id\">$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;} function get_all_stud_sel(){$ids=get_all_stud_id();echo "<option disabled>Выберите студента</option>";foreach($ids as $id){$sql="SELECT `Name` FROM `students` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){echo "<OPTION value=\"$id\">$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();}; return 1;} function get_all_spec_sel_opt($id){$ids=get_all_spec_id();foreach($ids as $id){$sql="SELECT `Name` FROM `spec` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql); while($row = $result->fetch_assoc()){foreach($row as $fieldValue){if($id==$fieldValue)$x="disabled";echo "<OPTION value=\"$id\" $x>$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;}function get_all_kaf_sel_opt($id){$ids=get_all_kaf_id();foreach($ids as $id){$sql="SELECT `Name` FROM `Departments` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){if($id==$fieldValue)$x="disabled";echo "<OPTION value=\"$id\" $x>$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;} function get_all_predm_sel_opt($id){$ids=get_all_predm_id();foreach($ids as $id){$sql="SELECT `Name` FROM `predm` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());} $mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){if($id==$fieldValue)$x="disabled";echo "<OPTION value=\"$id\" $x>$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;} function get_name_group_ved($ved){$sql="SELECT `id_predm` FROM `vedomosti_list` where `id`=$ved";$predm=getinfo($sql);$predm=$predm[0];$sql="SELECT `Name` FROM `predm` WHERE `id`=$predm";$name_predm=getinfo($sql);return $name_predm[0];} function get_all_lectors_opt($ved){$sql="SELECT `id_predm` FROM `vedomosti_list` where `id`=$ved";$predm=getinfo($sql);$predm=$predm[0];$sql="SELECT `id` FROM `lectures` WHERE `items_id` LIKE '%$predm%'"; $prep=getinfo($sql);for($x=0; $x<count($prep); $x++){$sql="SELECT `Surname`, `Name`, `Patronymic` FROM `lectures` WHERE `id`=".$prep[$x];$name=getinfo($sql);$name=$name[0]." ".$name[1]." ".$name[2];echo "<OPTION value=\"".$prep[$x]."\">$name</OPTION>\n"; } return 1;} function get_all_spec_sel(){$ids=get_all_spec_id();echo "<option disabled>Выберите специальность</option>";foreach($ids as $id){$sql="SELECT `Name` FROM `spec` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){echo "<OPTION value=\"$id\">$fieldValue</OPTION>\n";} }$result->close();$mysqli->close();};return 1;} function get_all_group_sel(){$ids=get_all_group_id();$count=count($ids); foreach($ids as $id){$sql="SELECT `name`, `year`, `group_number` from `group` WHERE `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql); for($k=1; $k<=$count; $k++){foreach($result->fetch_assoc() as $key => $value){if($key=="id")$id=$value;if($key=="name")$name=$value;if($key=="year")$year=$value;if($key=="group_number")$group_number=$value;if(($id)&&($name)&&($year)&&($group_number)) {echo "<OPTION value=\"$id\">$name$year$group_number</OPTION>\n";$id=""; $name="";$year=""; $group_number="";};};}; $result->close();$mysqli->close();};return 1;}; function get_all_predm_sel(){$ids=get_all_predm_id();echo "<option disabled>Выберите факультет</option>";foreach($ids as $id){$sql="SELECT `Name` FROM `predm` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);while($row = $result->fetch_assoc()){foreach($row as $fieldValue){echo "<OPTION value=\"$id\">$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;} function get_all_predm_chk(){$count= getinfo("SELECT count(`id`) from `predm`");$count=$count[0];$sql="SELECT `id`, `Name` from `predm`";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME); if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql);for($k=1; $k<=$count; $k++){foreach($result->fetch_assoc() as $key => $value){if($key=="id")$id=$value;if($key=="Name")$Name=$value;if(($id)&&($Name)) {echo "<label>$Name</label><INPUT TYPE=CHECKBOX NAME=items['$id'] VALUE=\"$id\"> <br />";$id=""; $Name="";};};};$result->close();$mysqli->close();return 1;}; function get_all_stepen_sel(){$ids=get_all_stepen_id();echo "<option disabled>Выберите степень</option>";foreach($ids as $id){$sql="SELECT `Name` FROM `stepeni` where `id`=$id";$mysqli = new mysqli(HOST_DB, DB_USER, DB_PASS, DB_NAME);if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}$mysqli->query('SET NAMES utf8');$result = $mysqli->query($sql); while($row = $result->fetch_assoc()){foreach($row as $fieldValue){echo "<OPTION value=\"$id\">$fieldValue</OPTION>\n";}}$result->close();$mysqli->close();};return 1;} function add_student($surname, $name, $patronymic, $spec, $N_zach, $year, $number_group){$sql="INSERT INTO `students`(`id`,`Surname`,`Name`,`Patronymic`,`Specialty`,`Entered`,`group_id`,`N_zach`)VALUES ('','$surname','$name','$patronymic','$spec','$year','$number_group','$N_zach')";execute($sql);return 1;}function add_lectures($kaf,$surname, $name, $patronymic, $stepen, $items){$sql="INSERT INTO `lectures`(`id`,`Surname`,`Name`,`Patronymic`,`Stepen_id`,`Departmen_id`,`items_id`)VALUES ('','$surname','$name','$patronymic','$stepen','$kaf','$items')";execute($sql);$_POST="";return 1;} function add_department($name,$ZavDepartment){$sql="INSERT INTO `Departments`(`id`,`Name`,`ZavDepartment`)VALUES ('','$name','$ZavDepartment')";execute($sql);$_POST="";return 1;} function add_groups($name,$year, $group_number){$sql="INSERT INTO `group` (`id`,`name`,`year`,`group_number`)VALUES ('','$name','$year','$group_number')";execute($sql);$_POST="";return 1;} function add_vedomosti($predm,$stud_id,$ocenka){$sql="INSERT INTO `vedomosti` (`id`,`id_stud`,`id_pred`,`ocenka`)VALUES ('','$stud_id','$predm','$ocenka')";execute($sql);$_POST="";return 1;} function add_spec($name){$sql="INSERT INTO `spec` (`id`,`Name`)VALUES ('','$name')";execute($sql);$_POST="";return 1;}function add_predm($name){$sql="INSERT INTO `predm`(`id`,`Name`)VALUES ('','$name')";execute($sql);$_POST="";return 1;} function edit_department($id, $name,$group_number){$sql= "UPDATE `rggu`.`group` SET `Name` = '$name', `year` = '$year', `group_number`='$group_number' WHERE `group`.`id` =$id";execute($sql);return 1;}; function edit_group($id, $name,$year, $group_number){$sql= "UPDATE `rggu`.`group` SET `name` = '$name', `year` = '$year', `group_number`='$group_number' WHERE `group`.`id` =$id";execute($sql);return 1;};function edit_lectures($id, $kaf,$surname, $name, $patronymic, $stepen, $items){$sql="UPDATE `rggu`.`lectures` SET`Surname` = '$surname',`Name` = '$name',`Patronymic`='$patronymic',`Stepen_id` ='$stepen',`Departmen_id` ='$kaf',`items_id`='$items'WHERE `lectures`.`id`=$id";execute($sql);return 1;} function edit_student($id,$surname, $name, $patronymic, $spec, $N_zach, $year, $number_group){$sql="UPDATE `rggu`.`students` SET`Surname`='$surname',`Name`='$name',`Patronymic`='$patronymic',`Specialty`='$spec',`Entered`='$year',`N_zach`='$N_zach',`group_id`='$number_group'WHERE `students`.`id`=$id;";execute($sql);return 1;} function edit_spec($id, $name){$sql= "UPDATE `rggu`.`spec` SET `Name` = '$name' WHERE `spec`.`id` =$id";execute($sql);return 1;}; function edit_predm($id, $name){$sql= "UPDATE `rggu`.`predm` SET `Name` = '$name' WHERE `predm`.`id` =$id";execute($sql);return 1;}; function get_items_name($items){$item_ar = explode (",", $items);foreach($item_ar as $value){$items_str.=", ".get_predm_name($value);}$items_str=substr($items_str,2,strlen($items_str)-2);return $items_str;}function get_kaf_name($id){$x=getinfo("SELECT `Name` from `Departments` WHERE `id`=$id");$x=$x[0];return $x;} function get_kurse($id){$x=getinfo("SELECT `Course` from `students` WHERE `id`=$id");$x=$x[0];return $x;}function get_entered($id){$x=getinfo("SELECT `Entered` from `students` WHERE `id`=$id");$x=$x[0];return $x;} function get_N_zach($id){$x=getinfo("SELECT `N_zach` from `students` WHERE `id`=$id");$x=$x[0];return $x;} function get_group_name($id){$x=getinfo("SELECT `name` from `group` WHERE `id`=$id");$x=$x[0];return $x;} function get_group_year($id){$x=getinfo("SELECT `year` from `group` WHERE `id`=$id");$x=$x[0];return $x;} function get_group_number($id){$x=getinfo("SELECT `group_number` from `group` WHERE `id`=$id");$x=$x[0];return $x;}function get_god_ob($id){$x=getinfo("SELECT `god_ob` from `students` WHERE `id`=$id");$x=$x[0];return $x;} function get_spec_name($id){$x=getinfo("SELECT `Name` from `spec` WHERE `id`=$id");$x=$x[0];return $x;}function get_group($id){$x=getinfo("SELECT `name`, `year`, `group_number` from `group` WHERE `id`=$id");$x=$x[0].$x[1].$x[2];return $x;}function get_predm_name($id){$x=getinfo("SELECT `Name` from `predm` WHERE `id`=$id");$x=$x[0];return $x;}function get_kaf_ZavDepartment($id){$x=getinfo("SELECT `ZavDepartment` from `Departments` WHERE `id`=$id");$x=$x[0];return $x;} function get_stepen_name($id){$x=getinfo("SELECT `Name` from `stepeni` WHERE `id`=$id");$x=$x[0];return $x;} function get_name_lectures($id){$x=getinfo("SELECT `Name` from `lectures` WHERE `id`=$id");$x=$x[0];return $x;} function get_name_students($id){$x=getinfo("SELECT `Name` from `students` WHERE `id`=$id");$x=$x[0];return $x;}function get_surname_lectures($id){$x=getinfo("SELECT `Surname` from `lectures` WHERE `id`=$id");$x=$x[0];return $x;}function get_surname_students($id){$x=getinfo("SELECT `Surname` from `students` WHERE `id`=$id");$x=$x[0];return $x;} function get_patronymic_students($id){$x=getinfo("SELECT `Patronymic` from `students` WHERE `id`=$id");$x=$x[0];return $x;} function get_patronymic_lectures($id){$x=getinfo("SELECT `Patronymic` from `lectures` WHERE `id`=$id");$x=$x[0];return $x;} function get_name_group_li(){ $sql='SELECT `id` FROM `lectures`';return (getinfo($sql));} function get_group_id(){$sql='SELECT `id` FROM `group`';return (getinfo($sql));}function vedomost_add_group($date, $group, $predm){$sql="INSERT INTO `vedomosti_list`(`id`,`id_predm`,group_id`,`date`)VALUES ('','$predm','$group','$date')";execute($sql);return 1;} function find_id_vedomost_group($date, $group, $predm){$sql="SELECT id from `vedomosti_list` WHERE `id_predm`=$predm AND `group_id`=$group AND `date`='$date'";$x=getinfo($sql);return $x[0];}function get_vedomost_group($ved){$sql="SELECT group_id from vedomosti_list where id=$ved";$group_id=getinfo($sql);$group_id=$group_id[0];$sql="SELECT id from students where group_id=$group_id";$ids=getinfo($sql);for($x=0; $x<count($ids);$x++){$sql="SELECT Surname, Name, Patronymic from students where id=$ids[$x]";$name=getinfo($sql);$name=$name[0]." ".$name[1]." ".$name[2];$sql="SELECT N_zach from students where id=$ids[$x]";$N_zach=getinfo($sql);$N_zach=$N_zach[0];$sql="SELECT ocenka from vedomosti where id_stud=$ids[$x] and id_ved=$ved";$ocenka=getinfo($sql);$ocenka= $ocenka[0];echo "<tr><td>$name</td><td>$N_zach</td><td><input type=\"text\" name=\"id[$ids[$x]]\" id=\"ocenka\" value=\"$ocenka\" maxlength=\"30\"/></td></tr>";}} function get_vedomost_group_list($group){$sql="SELECT `id` from vedomosti_list WHERE group_id=$group";$ids=getinfo($sql);for($x=0; $x<count($ids);$x++){$sql="SELECT `id_predm` from vedomosti_list WHERE id=$ids[$x]";$predm=getinfo($sql);$predm=$predm[0];$sql="SELECT `date` from vedomosti_list WHERE id=$ids[$x]";$date=getinfo($sql);$date=$date[0];echo "<a href=\"vedomost_group_edit.php?ved=$ids[$x]\">".$date." - ".get_predm_name($predm)."</a><br>";}}?>Размещено на Allbest.ru Date: 2015-12-13; view: 351; Нарушение авторских прав |