//echo 'Это sprav.php <br>'; $mysqli = mysqli_connect(HOST, USER, PASSWORD, DB_SPRAV89); if ($mysqli->connect_error) { die('Ошибка подключения (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } mysqli_query($mysqli, "SET NAMES utf8"); if (isset($_GET['org'])) { $org = $_GET['org']; } else { $org = 'Справочник'; } $q = 'SELECT * FROM `aliases` WHERE alias_ru="' . $org . '"'; $res = mysqli_query($mysqli, $q) or die(mysqli_error($mysqli)); $row = mysqli_fetch_array($res); //выберем одну строку (она и должна быть одна) $navy = navy_by_alias($mysqli, $row['alias_ru']); echo $navy; if ($row['table_name'] == 'sprav') { //получаем массив элемента — шапка head + строки telephones sprav($mysqli, $row['id']); } elseif ($row['table_name'] == 'roditel2') { roditel2($mysqli, $row['id']); } elseif ($row['table_name'] == 'roditel1') { roditel1($mysqli, $row['id']); } else { roditel0($mysqli); } function roditel0($mysqli) { $q1 = 'SELECT * FROM roditel1 ORDER BY kod'; $res1 = mysqli_query($mysqli, $q1) or die(mysqli_error());
function f_search($search) { //function search($_GET['search']) $mysqli = mysqli_connect(HOST, USER, PASSWORD, DB_SPRAV89); if ($mysqli->connect_error) { die('Ошибка подключения (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } mysqli_query($mysqli, "SET NAMES utf8"); $q = 'SELECT * FROM sprav WHERE naimenovanie_na_pechat LIKE "%' . $search . '%"'; $res = mysqli_query($mysqli, $q) or die(mysqli_error($mysqli)); while ($row = mysqli_fetch_array($res)) { $q_rod = 'SELECT * FROM roditel2 WHERE id ="' . $row['idr'] . '"'; $res_rod = mysqli_query($mysqli, $q_rod) or die(mysqli_error($mysqli)); $row_rod = mysqli_fetch_array($res_rod); $link = '' . PATH . '?org=' . $row['alias_ru'] . ''; echo '<div class="element">'; //отдельный контейнер по элементам, более узкий, все остальное выводим туда //выводим шапку элемента echo '<div class="naimenovanie_na_pechat"><a href=' . $link . ' class="naimenovanie_na_pechat_a">' . $row['naimenovanie_na_pechat'] . '</a></div>'; //Найдем группу - родителя if ($row['podzagolovok'] != "") { echo '<div class="podzagolovok">' . $row['podzagolovok'] . '</div>'; } if ($row['yuridicheskiy_status'] != "") { echo '<div class="yuridicheskiy_status">' . $row['yuridicheskiy_status'] . '</div>'; } if ($row['adres'] != "") { echo '<div class="adres">' . $row['adres'] . '</div>'; } if ($row['litso_dolzhnost'] != "") { echo '<div class="litso_dolzhnost">' . $row['litso_dolzhnost'] . '</div>'; } if ($row['litso_fio'] != "") { echo '<div class="litso_fio">' . $row['litso_fio'] . '</div>'; } // $idsprav = $row['id']; $aliassprav = $row['alias_ru']; $q_tel = 'SELECT * FROM sprav_tel WHERE idr ="' . $idsprav . '" ORDER BY nom_str'; $res_tel = mysqli_query($mysqli, $q_tel) or die(mysqli_error($mysqli)); echo '<table class="table_tel">'; //123 while ($row = mysqli_fetch_assoc($res_tel)) { //цикл по телефонам //01_adres_telefony_v_odnoy_stroke = Адрес, телефоны в одной строке if ($row['format_vyvoda_strok'] == '01_adres_telefony_v_odnoy_stroke') { $adres = $row['adres']; $tel = tel($row['telefony']); //адрес, теелфон echo '<tr>'; echo '<td class="adres_table">' . $adres . '</td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '01_adres_dolzhnost_fio_telefony_v_raznykh_strokakh') { $adres = $row['adres']; $litso_dolzhnost = $row['litso_dolzhnost']; $litso_fio = $row['litso_fio']; $tel = tel($row['telefony']); //адрес, теелфон echo '<tr>'; echo '<td class="adres_table">' . $adres . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_dolzhnost_table">' . $litso_dolzhnost . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_fio">' . $litso_fio . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '02_adres_telefony_v_raznykh_strokakh') { $adres = $row['adres']; $tel = tel($row['telefony']); //адрес echo '<tr>'; echo '<td class="adres_table">' . $adres . '</td><td></td>'; echo '</tr>'; //телефон echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '03_dolzhnost_telefony_v_odnoy_stroke') { $tel = tel($row['telefony']); echo '<tr>'; echo '<td class="litso_dolzhnost_table">' . $row['litso_dolzhnost'] . '</td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '04_dolzhnost_telefony_v_raznykh_strokakh') { $tel = tel($row['telefony']); echo '<tr>'; echo '<td class="litso_dolzhnost_table">' . $row['litso_dolzhnost'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '05_dolzhnost_fio_v_odnoy_stroke') { $litso_dolzhnost = $row['litso_dolzhnost']; $litso_fio = $row['litso_fio']; echo '<tr>'; echo '<td class="litso_dolzhnost">' . $litso_dolzhnost . '<span class="litso_fio">' . $litso_fio . '</span></td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '06_dolzhnost_fio_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="litso_dolzhnost">' . $row['litso_dolzhnost'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_fio">' . $row['litso_fio'] . '</td><td></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '09_podrazdelenie_adres_v_odnoy_stroke') { $podr = $row['podrazdelenie_filial']; $adres = $row['adres']; echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $podr . '</td><td class="adres_table">' . $adres . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '10_podrazdelenie_adres_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $row['podrazdelenie_filial'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="adres_table">' . $row['adres'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '11_podrazdelenie_adres_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial_table">' . $row['podrazdelenie_filial'] . '</td><td class="tel"></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="adres_table">' . $row['adres'] . '</td><td class="tel"></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '12_podrazdelenie_dolzhnost_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial_table">' . $row['podrazdelenie_filial'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_dolzhnost_table">' . $row['litso_dolzhnost'] . '</td><td></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '13_podrazdelenie_dolzhnost_fio_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial_table">' . $row['podrazdelenie_filial'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_dolzhnost_table">' . $row['litso_dolzhnost'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_fio">' . $row['litso_fio'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '14_podrazdelenie_dolzhnost_fio_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $row['podrazdelenie_filial'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_dolzhnost">' . $row['litso_dolzhnost'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="litso_fio">' . $row['litso_fio'] . '</td><td></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '15_podrazdelenie_telefony_v_odnoy_stroke') { $tel = tel($row['telefony']); echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $row['podrazdelenie_filial'] . '</td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '16_podrazdelenie_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $row['podrazdelenie_filial'] . '</td><td class="tel"></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '17_rezhim_raboty') { echo '<tr>'; echo '<td class="rezhimrabotystroka">' . $row['rezhimrabotystroka'] . '</td><td class="tel"></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '18_rezhim_raboty_s_dop_inf_v_raznykh_str_') { echo '<tr>'; echo '<td class="rezhimrabotystroka">' . $row['rezhimrabotystroka'] . '</td><td></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="dop_informatsiya">' . $row['dop_informatsiya'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '19_sayt_') { $sayt = $row['elpochta_sayt']; echo '<tr>'; echo '<td class="sayt_">Сайт:</td><td class="sayt"><a class="sayt_a" href="http://' . $sayt . '">' . $sayt . '</a></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '20_tolko_adres') { $adres = $row['adres']; echo '<tr>'; echo '<td class="adres_table">' . $row['adres'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '21_tolko_podrazdelenie') { echo '<tr>'; echo '<td class="podrazdelenie_filial">' . $row['podrazdelenie_filial'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '22_tolko_telefony') { $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '23_dop_informatsiya') { echo '<tr>'; echo '<td class="dop_informatsiya">' . $row['dop_informatsiya'] . '</td><td></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '24_fio_telefony_v_raznykh_strokakh') { echo '<tr>'; echo '<td class="litso_fio">' . $row['litso_fio'] . '</td><td></td>'; echo '</tr>'; $tel = tel($row['telefony']); echo '<tr>'; echo '<td></td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '25_fio_telefony_v_odnoy_stroke') { $tel = tel($row['telefony']); echo '<tr>'; echo '<td class="litso_fio">' . $row['litso_fio'] . '</td><td class="tel">' . $tel . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '25_elpochta') { $elpochta = $row['elpochta_sayt']; echo '<tr>'; echo '<td class="elpochta_">Эл.почта:</td><td class="elpochta"><a class="elpochta_a" href="mailto:' . $elpochta . '">' . $elpochta . '</a></td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '26_aska') { $ICQ = $row['elpochta_sayt']; echo '<tr>'; echo '<td class="icq_table_">ICQ</td><td class="tel">' . $ICQ . '</td>'; echo '</tr>'; } elseif ($row['format_vyvoda_strok'] == '27_skayp') { $Skype = $row['elpochta_sayt']; echo '<tr>'; echo '<td class="skype_table_">Skype</td><td class="tel">' . $Skype . '</td>'; echo '</tr>'; } else { echo '<tr>'; echo '<td>' . $row['nom_str'] . '</td><td>' . $row['format_vyvoda_strok'] . '</td>'; echo '</tr>'; } } //конец цикла по телефонам echo '</table>'; //echo '<table class="table_tel">'; $q = 'SELECT * FROM sprav_dop WHERE idr ="' . $idsprav . '" ORDER BY id'; $res_mat = mysqli_query($mysqli, $q) or die(mysqli_error($mysqli)); while ($row_mat = mysqli_fetch_assoc($res_mat)) { echo '' . $row_mat['html_code']; } //конец вывода доп.материала if ($mysqli->connect_error) { echo '</div>'; //'<div class="element">'; //отдельный контейнер по элементам, более узкий, все остальное выводим туда //добавляем строу навигации справочно $linknavy = navy_by_alias($mysqli, $aliassprav); echo '<div style="font-size: 85%; margin: 0px 10px 0px 4px; text-align: right"">' . $linknavy . '</div>'; } }