소스 파일 : /ex_run/language.php (2019-11-05)     소스 설명 : (구현항목) 프로그래밍 언어별 키워드(예약어)의 설명,구현사례 등 참조
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
<?php // (2019.11.05, 차재복, Cha Jae Bok, cjbword@gmailcom)

# 세션 스타트 (매 웹페이지 마다 필요)
	session_start();

# db 설정 
	include_once "../base_utils/db_conn.php";
		// 이로부터 db 접속 성공의 결과로써, $dbi 변수가 넘어옴

# db 테이블 쿼리
    $query = "select keyword,lang,type,url,title from language order by keyword,type";
	$result=mysqli_query($dbi, $query);
		if (mysqli_errno($dbi)) { echo mysqli_errno($dbi)." : ".mysqli_error($dbi)."\n";}
	while ( $matched = mysqli_fetch_assoc($result) ) {
        $array[$matched[keyword]][$matched[type]][] = $matched;
    }

# 스타일링
    echo "<style>
                #language td { padding:5px; }
                table#language { border-collapse:collapse; border:1px gray solid; }
            </style>";

    // table 형식으로 보여주기
    echo "<table id='language' border=1>";

        foreach($array as $key_3 => $val_3) {
            foreach($val_3 as $key_2 => $val_2) {
                foreach($val_2 as $key_1 => $val_1) {
                    if ($prev_keyword != $val_1[keyword]) {
                        echo "<tr>";
                            echo "<td rowspan=".count($val_3).">";
                                echo $val_1[keyword];
                            echo "</td>";
                            echo "<td rowspan=".count($val_3).">";
                                echo $val_1[lang];
                            echo "</td>";
                            echo "<td>";
                                if ($val_1[type] == 'exp') echo "설명참조";
                                if ($val_1[type] == 'src') echo "사용사례";
                            echo "</td>";
                            echo "<td>";
                                echo "&nbsp;";
                                echo "<a href='{$val_1[url]}' target='_blank'>".$val_1[title]."</a>";
                                echo "&nbsp;";
                            echo "</td>";
                        echo "</tr>";
                    } else {
                        if ($prev_type != $val_1[type]) {
                            echo "<tr>";
                                echo "<td>";
                                    if ($val_1[type] == 'exp') echo "설명참조";
                                    if ($val_1[type] == 'src') echo "사용사례";
                                echo "</td>";
                                echo "<td>";
                        }
                                echo "&nbsp;";
                                echo "<a href='{$val_1[url]}' target='_blank'>".$val_1[title]."</a>";
                                echo "&nbsp;";

                        if ($key_1 == count($val_2)-1) {
                                echo "</td>";
                            echo "</tr>";
                        }
                    }
                    $prev_keyword = $val_1[keyword];
                    $prev_type = $val_1[type];
                }
            }
        }

    echo "</table>";

/*
                    echo "<tr>";

                    if ($keyword != $prev_key) {
                        // keyword
                        echo "<td rowspan=".count($value).">";
                            echo $keyword;
                        echo "</td>";
                        // language type
                        echo "<td rowspan=".count($value).">";
                            echo $sub_val[lang];
                        echo "</td>";
                    }

                    if ($type == 0) {
                        echo "<td>";
                    } else {
                        echo "<td colspan=3>";
                    }
                        if ($sub_val[type] == 'exp') echo "설명참조 : ";
                        if ($sub_val[type] == 'src') echo "사용사례 : ";
                        echo "<a href='{$sub_val[url]}' target='_blank'>".$sub_val[title]."</a>";
                    echo "</td>";
    
                    echo "</tr>";

                $prev_key = $keyword;
*/

    echo "<br>... 시험 개발중 ... (추후, 검색 기능 추가 예정)";
?>
Copyrightⓒ written by 차재복 (Cha Jae Bok)