{"id":2268,"date":"2014-09-20T16:19:19","date_gmt":"2014-09-20T07:19:19","guid":{"rendered":"http:\/\/www.happyfam.or.kr\/ysoh\/?p=2268"},"modified":"2016-06-01T11:35:08","modified_gmt":"2016-06-01T02:35:08","slug":"webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3","status":"publish","type":"post","link":"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/","title":{"rendered":"WebDB(II) \uc2e4\uc2b5\uc608\uc81c \uc18c\uc2a4 #3"},"content":{"rendered":"<pre class=\"wrap:true lang:php decode:true \" title=\"examSQL-04.php\">&lt;?php\r\n\r\nrequire '.\/dbConn.php';\r\n\r\n$link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\nmysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\nmysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n\r\n$sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\necho $sql;\r\n\r\nmysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n\r\nmysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n?&gt;<\/pre>\n<div id=\"attachment_2315\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2315\" data-attachment-id=\"2315\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-04\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?fit=394%2C263&amp;ssl=1\" data-orig-size=\"394,263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-04\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?fit=394%2C263&amp;ssl=1\" class=\"wp-image-2315 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?resize=394%2C263\" alt=\"examSQL-04\" width=\"394\" height=\"263\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?resize=120%2C80&amp;ssl=1 120w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2315\" class=\"wp-caption-text\">examSQL-04.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n<pre class=\"wrap:true lang:php decode:true \" title=\"examSQL-05.php\">&lt;?php\r\n\r\nrequire '.\/dbConn.php';\r\n\r\n$link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\nmysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\nmysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n\r\n$sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\necho $sql;\r\n\r\n$result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n\r\n$num = mysqli_num_rows($result); \/\/ \uac80\uc0c9\ub41c \ub808\ucf54\ub4dc \uc218\r\necho \"{$num}\uac1c\uc758 \uacb0\uacfc\uac00 \uac80\uc0c9\ub410\uc2b5\ub2c8\ub2e4.\";\r\n\r\n$row = mysqli_fetch_array($result); \/\/ \uac80\uc0c9\ub41c \uacb0\uacfc\uc5d0\uc11c \ub808\ucf54\ub4dc \ud558\ub098\ub97c \uac00\uc838\uc634\r\necho $row[\"userid\"]; \/\/ \ud544\ub4dc\uba85\uc744 \ud0a4\ub85c\ud558\uc5ec \uc6d0\ud558\ub294 \ub370\uc774\ud130\uc5d0 \uc811\uadfc\r\necho $row[\"passwd\"];\r\necho $row[\"name\"];\r\necho $row[\"email\"];\r\n\r\nmysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n?&gt;<\/pre>\n<div id=\"attachment_2316\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2316\" data-attachment-id=\"2316\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-05\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?fit=394%2C263&amp;ssl=1\" data-orig-size=\"394,263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-05\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?fit=394%2C263&amp;ssl=1\" class=\"wp-image-2316 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?resize=394%2C263\" alt=\"examSQL-05\" width=\"394\" height=\"263\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-05.png?resize=120%2C80&amp;ssl=1 120w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2316\" class=\"wp-caption-text\">examSQL-05.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n<pre class=\"wrap:true lang:php decode:true\" title=\"examSQL-06.php\">&lt;?php\r\n\r\nrequire '.\/dbConn.php';\r\n\r\n$link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\nif (!$link) { \/\/ DB\uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!link, $link!=true, $link==false \ubaa8\ub450 \ub3d9\uc77c)\r\n    echo \"DB \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.\";\r\n    exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n}\r\n\r\n$db = mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\nif (!$db) {  \/\/ DB\uc120\ud0dd\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$db, $db!=true, $db==false \ubaa8\ub450 \ub3d9\uc77c)\r\n    echo \"{$dbName} \uc774\ub984\uc758 DB\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\";\r\n    exit();  \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n}\r\n\r\n$char = mysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\nif (!$char) { \/\/ \ubb38\uc790\uc14b \uc124\uc815\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$char, $char!=true, $char==false \ubaa8\ub450 \ub3d9\uc77c)\r\n    echo \"UTF-8 \ubb38\uc790\uc14b\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.\";\r\n    exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n}\r\n\r\n$sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\necho $sql;\r\n\r\n$result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\nif (!$result) { \/\/ SQL\uc5d0 \uc624\ub958\uac00 \uc788\ub294 \uacbd\uc6b0\r\n    echo \"SQL\uc5d0 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4.\";\r\n    exit();     \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n}\r\n\r\n$num = mysqli_num_rows($result); \/\/ \uac80\uc0c9\ub41c \ub808\ucf54\ub4dc \uc218\r\necho \"{$num}\uac1c\uc758 \uacb0\uacfc\uac00 \uac80\uc0c9\ub410\uc2b5\ub2c8\ub2e4.\";\r\n\r\n$row = mysqli_fetch_array($result); \/\/ \uac80\uc0c9\ub41c \uacb0\uacfc\uc5d0\uc11c \ub808\ucf54\ub4dc \ud558\ub098\ub97c \uac00\uc838\uc634\r\nif ($row != null) { \/\/ \uac80\uc0c9\ub41c \uacb0\uacfc\uac00 \uc788\uc73c\uba74\r\n    echo $row[\"userid\"]; \/\/ \ud544\ub4dc\uba85\uc744 \ud0a4\ub85c\ud558\uc5ec \uc6d0\ud558\ub294 \ub370\uc774\ud130\uc5d0 \uc811\uadfc\r\n    echo $row[\"passwd\"];\r\n    echo $row[\"name\"];\r\n    echo $row[\"email\"];\r\n}\r\n\r\nmysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n?&gt;<\/pre>\n<div id=\"attachment_2318\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2318\" data-attachment-id=\"2318\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-06\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?fit=394%2C263&amp;ssl=1\" data-orig-size=\"394,263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-06\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?fit=394%2C263&amp;ssl=1\" class=\"wp-image-2318 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?resize=394%2C263\" alt=\"examSQL-06\" width=\"394\" height=\"263\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-06.png?resize=120%2C80&amp;ssl=1 120w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2318\" class=\"wp-caption-text\">examSQL-06.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n<pre class=\"wrap:true lang:php decode:true\" title=\"examSQL-07.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"UTF-8\"&gt;\r\n        &lt;title&gt;examSQL-07.php&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;?php\r\n        require '.\/dbConn.php';\r\n\r\n        $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\n        if (!$link) { \/\/ DB\uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!link, $link!=true, $link==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"DB \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $db = mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\n        if (!$db) {  \/\/ DB\uc120\ud0dd\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$db, $db!=true, $db==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"{$dbName} \uc774\ub984\uc758 DB\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\";\r\n            exit();  \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $char = mysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n        if (!$char) { \/\/ \ubb38\uc790\uc14b \uc124\uc815\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$char, $char!=true, $char==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"UTF-8 \ubb38\uc790\uc14b\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\n        echo $sql;\r\n\r\n        $result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n        if (!$result) { \/\/ SQL\uc5d0 \uc624\ub958\uac00 \uc788\ub294 \uacbd\uc6b0\r\n            echo \"SQL\uc5d0 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4.\";\r\n            exit();     \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $num = mysqli_num_rows($result); \/\/ \uac80\uc0c9\ub41c \ub808\ucf54\ub4dc \uc218\r\n        echo \"{$num}\uac1c\uc758 \uacb0\uacfc\uac00 \uac80\uc0c9\ub410\uc2b5\ub2c8\ub2e4.\";\r\n\r\n        $row = mysqli_fetch_array($result); \/\/ \uac80\uc0c9\ub41c \uacb0\uacfc\uc5d0\uc11c \ub808\ucf54\ub4dc \ud558\ub098\ub97c \uac00\uc838\uc634\r\n        if ($row != null) { \/\/ \uac80\uc0c9\ub41c \uacb0\uacfc\uac00 \uc788\uc73c\uba74\r\n            echo $row[\"userid\"]; \/\/ \ud544\ub4dc\uba85\uc744 \ud0a4\ub85c\ud558\uc5ec \uc6d0\ud558\ub294 \ub370\uc774\ud130\uc5d0 \uc811\uadfc\r\n            echo $row[\"passwd\"];\r\n            echo $row[\"name\"];\r\n            echo $row[\"email\"];\r\n        }\r\n\r\n        mysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n        ?&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<div id=\"attachment_2317\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2317\" data-attachment-id=\"2317\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-07\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?fit=394%2C263&amp;ssl=1\" data-orig-size=\"394,263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-07\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?fit=394%2C263&amp;ssl=1\" class=\"wp-image-2317 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?resize=394%2C263\" alt=\"examSQL-07\" width=\"394\" height=\"263\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-07.png?resize=120%2C80&amp;ssl=1 120w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2317\" class=\"wp-caption-text\">examSQL-07.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n<pre class=\"wrap:true lang:php decode:true\" title=\"examSQL-08.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"UTF-8\"&gt;\r\n        &lt;title&gt;examSQL-08.php&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;?php\r\n        require '.\/dbConn.php';\r\n\r\n        $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\n        if (!$link) { \/\/ DB\uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!link, $link!=true, $link==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"DB \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $db = mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\n        if (!$db) {  \/\/ DB\uc120\ud0dd\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$db, $db!=true, $db==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"{$dbName} \uc774\ub984\uc758 DB\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\";\r\n            exit();  \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $char = mysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n        if (!$char) { \/\/ \ubb38\uc790\uc14b \uc124\uc815\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$char, $char!=true, $char==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"UTF-8 \ubb38\uc790\uc14b\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\n        echo $sql;\r\n\r\n        $result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n        if (!$result) { \/\/ SQL\uc5d0 \uc624\ub958\uac00 \uc788\ub294 \uacbd\uc6b0\r\n            echo \"SQL\uc5d0 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4.\";\r\n            exit();     \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $num = mysqli_num_rows($result); \/\/ \uac80\uc0c9\ub41c \ub808\ucf54\ub4dc \uc218\r\n        echo \"{$num}\uac1c\uc758 \uacb0\uacfc\uac00 \uac80\uc0c9\ub410\uc2b5\ub2c8\ub2e4.\";\r\n\r\n        while ($row = mysqli_fetch_array($result)) { \/\/ \ub8e8\ud504\ub97c \ub3cc\uba70 \uac80\uc0c9\ub41c \uacb0\uacfc\uc5d0\uc11c \ub9c8\uc9c0\ub9c9\uc774 \ub420 \ub54c\uae4c\uc9c0 \ub808\ucf54\ub4dc\ub97c \ud558\ub098\uc529 \uac00\uc838\uc634\r\n            echo $row[\"userid\"]; \/\/ \ud544\ub4dc\uba85\uc744 \ud0a4\ub85c\ud558\uc5ec \uc6d0\ud558\ub294 \ub370\uc774\ud130\uc5d0 \uc811\uadfc\r\n            echo $row[\"passwd\"];\r\n            echo $row[\"name\"];\r\n            echo $row[\"email\"];\r\n        }\r\n\r\n        mysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n        ?&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<div id=\"attachment_2313\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2313\" data-attachment-id=\"2313\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-08\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?fit=394%2C263&amp;ssl=1\" data-orig-size=\"394,263\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-08\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?fit=394%2C263&amp;ssl=1\" class=\"wp-image-2313 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?resize=394%2C263\" alt=\"examSQL-08\" width=\"394\" height=\"263\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-08.png?resize=120%2C80&amp;ssl=1 120w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2313\" class=\"wp-caption-text\">examSQL-08.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n<pre class=\"wrap:true lang:php decode:true\" title=\"examSQL-09.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"UTF-8\"&gt;\r\n        &lt;title&gt;examSQL-09.php&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;?php\r\n        require '.\/dbConn.php';\r\n\r\n        $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\n        if (!$link) { \/\/ DB\uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!link, $link!=true, $link==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"DB \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.&lt;br\/&gt;\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $db = mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\n        if (!$db) {  \/\/ DB\uc120\ud0dd\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$db, $db!=true, $db==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"{$dbName} \uc774\ub984\uc758 DB\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.&lt;br\/&gt;\";\r\n            exit();  \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $char = mysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n        if (!$char) { \/\/ \ubb38\uc790\uc14b \uc124\uc815\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$char, $char!=true, $char==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"UTF-8 \ubb38\uc790\uc14b\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.&lt;br\/&gt;\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $sql = \"SELECT `userid`, `passwd`, `name`, `email` FROM `user`\";\r\n        echo \"{$sql}&lt;br\/&gt;&lt;br\/&gt;\";\r\n\r\n        $result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n        if (!$result) { \/\/ SQL\uc5d0 \uc624\ub958\uac00 \uc788\ub294 \uacbd\uc6b0\r\n            echo \"SQL\uc5d0 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4.&lt;br\/&gt;\";\r\n            exit();     \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $num = mysqli_num_rows($result); \/\/ \uac80\uc0c9\ub41c \ub808\ucf54\ub4dc \uc218\r\n        echo \"{$num}\uac1c\uc758 \uacb0\uacfc\uac00 \uac80\uc0c9\ub410\uc2b5\ub2c8\ub2e4.&lt;br\/&gt;&lt;br\/&gt;\";\r\n\r\n        while ($row = mysqli_fetch_array($result)) { \/\/ \ub8e8\ud504\ub97c \ub3cc\uba70 \uac80\uc0c9\ub41c \uacb0\uacfc\uc5d0\uc11c \ub9c8\uc9c0\ub9c9\uc774 \ub420 \ub54c\uae4c\uc9c0 \ub808\ucf54\ub4dc\ub97c \ud558\ub098\uc529 \uac00\uc838\uc634\r\n            echo \"\uc544\uc774\ub514 : {$row[\"userid\"]}&lt;br\/&gt;\"; \/\/ \ud544\ub4dc\uba85\uc744 \ud0a4\ub85c\ud558\uc5ec \uc6d0\ud558\ub294 \ub370\uc774\ud130\uc5d0 \uc811\uadfc\r\n            echo \"\ube44\ubc00\ubc88\ud638 : {$row[\"passwd\"]}&lt;br\/&gt;\";\r\n            echo \"\uc131\uba85 : {$row[\"name\"]}&lt;br\/&gt;\";\r\n            echo \"\uc774\uba54\uc77c : {$row[\"email\"]}&lt;br\/&gt;\";\r\n        }\r\n\r\n        mysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n        ?&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<div id=\"attachment_2314\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2314\" data-attachment-id=\"2314\" data-permalink=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/examsql-09\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png?fit=394%2C501&amp;ssl=1\" data-orig-size=\"394,501\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"examSQL-09\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png?fit=394%2C501&amp;ssl=1\" class=\"wp-image-2314 size-full\" src=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png?resize=394%2C501\" alt=\"examSQL-09\" width=\"394\" height=\"501\" srcset=\"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png?w=394&amp;ssl=1 394w, https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-09.png?resize=235%2C300&amp;ssl=1 235w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-2314\" class=\"wp-caption-text\">examSQL-09.php \uc2e4\ud589\uacb0\uacfc<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php require &#8216;.\/dbConn.php&#8217;; $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0 mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd mysqli_set_charset($link, &#8220;utf8&#8221;); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815 $sql = &#8220;SELECT `userid`, `passwd`, `name`, `email` FROM `user`&#8221;; echo $sql; mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589 mysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc ?&gt; &lt;?php require &#8216;.\/dbConn.php&#8217;; $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-3\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":3,"featured_media":2315,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[134,2],"tags":[233,21,34,40,53],"class_list":["post-2268","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webdbii","category-2","tag-database","tag-html","tag-mysql","tag-php","tag-webdb"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.happyfam.or.kr\/ysoh\/wp-content\/uploads\/sites\/3\/2014\/09\/examSQL-04.png?fit=394%2C263&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p776QY-AA","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts\/2268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/comments?post=2268"}],"version-history":[{"count":0,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts\/2268\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/media\/2315"}],"wp:attachment":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/media?parent=2268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/categories?post=2268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/tags?post=2268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}