{"id":547,"date":"2024-04-15T08:15:44","date_gmt":"2024-04-14T23:15:44","guid":{"rendered":"http:\/\/inwelly.com\/?p=547"},"modified":"2024-04-23T05:29:23","modified_gmt":"2024-04-22T20:29:23","slug":"php-%ed%8c%8c%ec%9d%bc-%ec%9d%bd%ea%b8%b0-%ed%99%95%ec%9d%b8-db-%ec%9e%90%eb%a3%8c%ec%99%80-%eb%b9%84%ea%b5%90-%eb%b0%8f-%ec%88%98%ec%a0%95%ed%95%98%ec%97%ac-%ec%b6%9c%eb%a0%a5","status":"publish","type":"post","link":"https:\/\/inwelly.com\/?p=547","title":{"rendered":"PHP \ud30c\uc77c \uc77d\uae30 \ud655\uc778 DB \uc790\ub8cc\uc640 \ube44\uad50 \ubc0f \uc218\uc815\ud558\uc5ec \ucd9c\ub825"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>include \".\/configdbc.php\";  \/\/ \ub514\ube44\uc5f0\uacb0\n\n$filename = \"\/home\/filename.txt\";\n $fp = fopen($filename, \"r\") or die(\"\ud30c\uc77c\uc5f4\uae30\uc5d0 \uc2e4\ud328\ud558\uc600\uc2b5\ub2c8\ub2e4\");\n\n while(!feof($fp))\n {\n \n $fpt = fgets($fp);\n \n $str = explode(\",\",$fpt);\n $count_ea = count($str);\n\n for($i = 0; $i &lt;= $count_ea; $i++)\n {\n \n  $value_trim = trim($str&#91;$i]);\n\n  $__QUE002    = \"select * from tablename where \uceec\ub7fc\uc774\ub984='$value_trim' \";\n  $__RES002     = mysql_query($__QUE002);\n  $__ROW002     = mysql_fetch_array($__RES002);\n  \n  \/\/ echo \"$__QUE002 &lt;br>\";\n  \n  if( $i == 0 )\n  {\n   $textview = \"\";\n  }\n  else\n  {\n   $textview = \",\";\n  }\n\n  if( $__ROW002&#91;\uc694\uccad\uceec\ub7fc] ) { $studentgubunidx = $textview.$__ROW002&#91;\uc694\uccad\uceec\ub7fc] ;  } else { $studentgubunidx = $textview.$value_trim ; }\n   \n   $arryidx .= $studentgubunidx  ;\n   \n   \/\/ $str&#91;$i]\n }\n\n $arryidx_cut = substr( $arryidx ,0, -1 ) ;\n\n\/\/ $buffer .= $fpt.\" \/ \" . $arryidx . \"&lt;br>\";\n $buffer .= $arryidx_cut . \"&lt;br>\";\n $arryidx = \"\";\n\n }\n echo $buffer;\n \n fclose($fp);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1251,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-547","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=547"}],"version-history":[{"count":1,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/547\/revisions"}],"predecessor-version":[{"id":548,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/547\/revisions\/548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/media\/1251"}],"wp:attachment":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}