{"id":1356,"date":"2003-08-11T16:41:49","date_gmt":"2003-08-11T16:41:49","guid":{"rendered":"http:\/\/bluesoul.pe.kr\/wp\/?p=1356"},"modified":"2003-08-11T16:41:49","modified_gmt":"2003-08-11T16:41:49","slug":"php%ed%81%b4%eb%9e%98%ec%8a%a4-%eb%a7%8c%eb%93%a4%ec%96%b4-%ec%93%b0%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/bluesoul.pe.kr\/wp\/?p=1356","title":{"rendered":"[PHP]\ud074\ub798\uc2a4 \ub9cc\ub4e4\uc5b4 \uc4f0\uae30"},"content":{"rendered":"<p> php\ub3c4  \ud074\ub798\uc2a4\ub97c  \ub9cc\ub4e4\uc5b4  \uc4f8\uc218  \uc788\ub2e4.  \ub2e4\ub4e4  \uc54c\uaca0\uc9c0\ub9cc<br \/>\n\ubcf4\ud1b5  \ub9c8\ub2c8  \uc4f0\uc774\ub294  \ud568\uc218\ub4e4\uc744  \ud074\ub798\uc2a4\ub85c  \ub9cc\ub4e4\uc5b4  \ud544\uc694\ud560\ub54c  \ub9c8\ub2e4  \ubd88\ub7ec\uc4f0\uba74  \ud3b8\ub9ac\ud558\ub2e4.<br \/>\n\ub514\ube44\uad00\ub828\ub41c\uac70\ub098  \ud398\uc774\uc9d5  \uad00\ub828  \ud568\uc218\ub4e4\uc744  \ub9c8\ub2c8\ub4e4  \ud074\ub798\uc2a4\ub85c  \ub9cc\ub4e4\uc5b4  \uc4f4\ub2e4.<\/p>\n<p>\ub514\ube44  \uad00\ub828  \ud074\ub798\uc2a4\ub97c  \ub9cc\ub4e4\uc5b4\ubcf4\uc790.<br \/>\nphp\uc2a4\ucfe8\uc5d0  \ub098\uc640  \uc788\ub294\uac83\ub4e4\uc744  \ucc38\uc870\ud588\ub294\ub370..<br \/>\n\ud5c8\uc811\ud568\uc744  \ubbf8\ub9ac  \uace0\ubc31\ud55c\ub2e4.  \ub098\uc5d0\uac8c  \ud544\uc694\ud55c  \uae30\ub2a5\ub9cc\uc744  \ub9cc\ub4e4\uc5c8\uae30  \ub54c\ubb38\uc774\uace0..<br \/>\n\uc544\uc9c1  \uac80\uc99d\uc774  \uc548\ub42c\uae30  \ub54c\ubb38\uc774\ub2e4..<br \/>\n\ubd80\ub514  \ucc38\uc870\ub9cc  \ud558\uae30  \ubc14\ub780\ub2e4.<\/p>\n<p>dbclass.inc<br \/>\n<?\n\nclass  MySqlDb{\n    var  $Conn;\n    var  $Host;\n    var  $UserName;\n    var  $Password;\n    var  $DatabaseName;\n        \n    var  $Res;\n    var  $Row;\n    \n    \n    \/\/\uc0dd\uc131\uc790\n    function  MySqlDb($Host,$UserName,$Password,$DatabaseName){\n        $this->Host  =  $Host;<br \/>\n        $this->UserName  =  $UserName;<br \/>\n        $this->Password  =  $Password;<br \/>\n        $this->DatabaseName  =  $DatabaseName;<br \/>\n    }<\/p>\n<p>    \/\/\ub514\ube44  \uc5f0\uacb0<br \/>\n    function  Connect(){<br \/>\n        $this->Conn  =  mysql_connect($this->Host,$this->UserName,$this->Password);<\/p>\n<p>        if(!$this->Conn){<br \/>\n            $this->halt(&#8220;Host\ub97c  \uc5f0\uacb0\ud560  \uc218\uac00  \uc5c6\uc2b5\ub2c8\ub2e4.&#8221;);<br \/>\n        }else{<\/p>\n<p>            if(  !mysql_select_db($this->DatabaseName,$this->Conn)  ){<\/p>\n<p>                $this->halt(&#8220;DB\ub97c  \uc5f0\uacb0\ud560  \uc218\uac00  \uc5c6\uc2b5\ub2c8\ub2e4.&#8221;);<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/\ucffc\ub9ac\ubb38\uc744  \uc774\uc6a9\ud558\uc5ec  resultset  \uac12\uc744  \ub9cc\ub4e0\ub2e4.<br \/>\n    function  Query($qry){<\/p>\n<p>        $this->Res  =  mysql_query($qry,$this->Conn);<br \/>\n        if(!$this->Res){<br \/>\n            $this->halt(&#8220;\ucffc\ub9ac\ubb38\uc81c  =>  $qry&#8221;);<br \/>\n        }<\/p>\n<p>        return  $this->Res;<\/p>\n<p>    }<\/p>\n<p>    \/\/resultset  \uac12\uc744  \uc774\uc6a9\ud558\uc5ec  \uc2e4\uc81c  \ub370\uc774\ud130  \uac12\uc744  \ubc30\uc5f4\ub85c  \ub9ac\ud134\ud55c\ub2e4.<br \/>\n    function  Row($res){<\/p>\n<p>        $this->Row  =  mysql_fetch_row($res);<br \/>\n        return  $this->Row;<br \/>\n    }<\/p>\n<p>    \/\/resultset\uc744  \ub9cc\ub4e4\uba74\uc11c  \uc0dd\uc131\ub41c  \uba54\ubaa8\ub9ac\ub97c  \ud574\uc81c\ud55c\ub2e4.<br \/>\n    \/\/@\ub294  \uc5d0\ub7ec\uac00  \ub098\ub3c4  \ub118\uae34\ub2e4.<br \/>\n    function  FreeResult(){<br \/>\n        @mysql_free_result($this->Res);<\/p>\n<p>    }<\/p>\n<p>    \/\/\ub514\ube44\uc5f0\uacb0\uc744  \ud574\uc81c\ud55c\ub2e4.<br \/>\n    function  Disconnect(){<\/p>\n<p>        @mysql_close($this->Conn);<\/p>\n<p>        \/\/\uba54\ubaa8\ub9ac\uc5d0\uc11c  \ubcc0\uc218\ub4e4\uc744  \ud574\uc81c\ud55c\ub2e4.<br \/>\n        unset($this->Conn);<br \/>\n        unset($this->Host);<br \/>\n        unset($this->UserName);<br \/>\n        unset($this->Password);<br \/>\n        unset($this->DatabaseName);<br \/>\n        unset($this->Res);<br \/>\n        unset($this->Row);                  <\/p>\n<p>    }<\/p>\n<p>    \/\/  \uc5d0\ub7ec\uba54\uc2dc\uc9c0  \ucd9c\ub825\ud568\uc218<br \/>\n    function  halt($massage){<\/p>\n<p>        $this  ->  Errno  =  mysql_errno();<br \/>\n        $this  ->  Error  =  mysql_error();<\/p>\n<p>        echo  &#8220;<font  color=red>Oops~!!  Database  Error<\/font>  :  $massage  <\/p>\n<p>&#8221;  ;<br \/>\n        echo  &#8220;$this->Errno  ($this->Error)  <\/p>\n<p>&#8220;;<br \/>\n        die  (&#8216;process  halted&#8217;);<br \/>\n    }<\/p>\n<p>    \/\/filed\uc5d0  \ub530\ub978  \ucd5c\ub300\uac12\uc744  \uad6c\ud55c\ub2e4.<br \/>\n    function  MaxNum($fld,$tbn){<\/p>\n<p>        $qry  =  &#8220;select  max($fld)  from  $tbn&#8221;;<br \/>\n        $res=$this->Query($qry);<br \/>\n        $this->Row($res);<\/p>\n<p>        if($this->Row[0]){<br \/>\n            $maxnum  =  $this->Row[0]+1;<br \/>\n        }else{<br \/>\n            $maxnum  =  1;<br \/>\n        }<\/p>\n<p>        $this->FreeResult();<\/p>\n<p>        return  $maxnum;<br \/>\n    }<\/p>\n<p>    \/\/\uc870\uac74\uc5d0  \ub530\ub978  \uce74\uc6b4\ud2b8\ub97c  \ud55c\ub2e4.<br \/>\n    function  Count($fld,$tbn,$where){<br \/>\n        $qry  =  &#8220;select  count($fld)  from  $tbn  $where  &#8220;;<br \/>\n        $res=$this->Query($qry);<br \/>\n        $this->Row($res);<\/p>\n<p>        $this->FreeResult();<\/p>\n<p>        return  $this->Row[0];<\/p>\n<p>    }<\/p>\n<p>}<br \/>\n?><\/p>\n<p>\ub2e4\uc74c\uc740  \uc4f0\ub294  \ubc29\ubc95\uc744  \uc124\uba85\ud55c\ub2e4.<\/p>\n<p><?\n\/\/\ub514\ube44\uad00\ub828  \ud074\ub798\uc2a4\uac00  \uc788\ub294  \ud30c\uc77c\uc744  \uc778\ud074\ub8e8\ub4dc  \ud55c\ub2e4.\ninclude  \"dbclass.inc\";\n\n\/\/\ud074\ub798\uc2a4\ub97c  \uc0dd\uc131\ud55c\ub2e4.\n$mysql  =  new  MySqlDb(\"localhost\",\"\uacc4\uc815\uc544\uc774\ub514\",\"\ud328\uc2a4\uc6cc\ub4dc\",\"\ub514\ube44\uba85\");\n\n\/\/\ub514\ube44\ub97c  \uc5f0\uacb0\ud55c\ub2e4.\n$mysql->Connect();<\/p>\n<p>\/\/Count\ud568\uc218\ub97c  \uc368\uc11c  row\uc218\ub97c  \uad6c\ud55c\ub2e4.<br \/>\n$rows=$mysql->Count(&#8220;num&#8221;,$tbn,&#8221;where  num  =  $num&#8221;);<\/p>\n<p>if($rows>0){<br \/>\n    $query  =  &#8220;select  num,targetdate,enddate,writer,subject,content,texthtml,filename,regdate,hits,ipAddr  from  $tbn  where  num=$num&#8221;;<\/p>\n<p>    \/\/\ucffc\ub9ac\ubb38\uc73c\ub85c  resultset  \uc744  \ub9cc\ub4e4\uace0<br \/>\n    $res  =  $mysql->Query($query);<br \/>\n    \/\/\ubc30\uc5f4\uac12\uc744  \ub9ac\ud134\ud55c\ub2e4.<br \/>\n    $row  =  $mysql->Row($res);<\/p>\n<p>    \/\/\uac01\uac01\uc758\uacb0\uacfc\uac12\ub4e4\uc744  \uac00\uc838\uc628\ub2e4.<br \/>\n    $num  =  $row[0];<br \/>\n    $targetdate  =  $row[1];<br \/>\n    $enddate  =  $row[2];<br \/>\n    $writer  =  $row[3];<br \/>\n    $subject  =  $row[4];<br \/>\n    $content  =  $row[5];<br \/>\n    $texthtml  =  $row[6];<br \/>\n    $filename  =  $row[7];<br \/>\n    $regdate  =  $row[8];<br \/>\n    $hits  =  $row[9];<br \/>\n    $ipAddr  =  $row[10];<\/p>\n<p>    \/\/\uba54\ubaa8\ub9ac\uc5d0\uc11c  \ud574\uc81c\ud55c\ub2e4.<br \/>\n    $mysql->FreeResult();<\/p>\n<p>}<\/p>\n<p>\/\/\ub514\ube44\uc5f0\uacb0\uc744  \ud574\uc81c\ud55c\ub2e4.<br \/>\n$mysql->Disconnect();<br \/>\n?> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>php\ub3c4 \ud074\ub798\uc2a4\ub97c \ub9cc\ub4e4\uc5b4 \uc4f8\uc218 \uc788\ub2e4. \ub2e4\ub4e4 \uc54c\uaca0\uc9c0\ub9cc \ubcf4\ud1b5 \ub9c8\ub2c8 \uc4f0\uc774\ub294 \ud568\uc218\ub4e4\uc744 \ud074\ub798\uc2a4\ub85c \ub9cc\ub4e4\uc5b4 \ud544\uc694\ud560\ub54c \ub9c8\ub2e4 \ubd88\ub7ec\uc4f0\uba74 \ud3b8\ub9ac\ud558\ub2e4. \ub514\ube44\uad00\ub828\ub41c\uac70\ub098 \ud398\uc774\uc9d5 \uad00\ub828 \ud568\uc218\ub4e4\uc744 \ub9c8\ub2c8\ub4e4 \ud074\ub798\uc2a4\ub85c \ub9cc\ub4e4\uc5b4 \uc4f4\ub2e4. \ub514\ube44 \uad00\ub828 \ud074\ub798\uc2a4\ub97c \ub9cc\ub4e4\uc5b4\ubcf4\uc790. php\uc2a4\ucfe8\uc5d0 \ub098\uc640 \uc788\ub294\uac83\ub4e4\uc744 \ucc38\uc870\ud588\ub294\ub370.. \ud5c8\uc811\ud568\uc744 \ubbf8\ub9ac \uace0\ubc31\ud55c\ub2e4. \ub098\uc5d0\uac8c \ud544\uc694\ud55c \uae30\ub2a5\ub9cc\uc744 \ub9cc\ub4e4\uc5c8\uae30 \ub54c\ubb38\uc774\uace0.. \uc544\uc9c1 \uac80\uc99d\uc774 \uc548\ub42c\uae30 \ub54c\ubb38\uc774\ub2e4.. \ubd80\ub514 \ucc38\uc870\ub9cc \ud558\uae30 \ubc14\ub780\ub2e4. dbclass.inc \ub2e4\uc74c\uc740 \uc4f0\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud55c\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1356","post","type-post","status-publish","format-standard","hentry","category-tip"],"_links":{"self":[{"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1356"}],"version-history":[{"count":0,"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1356\/revisions"}],"wp:attachment":[{"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluesoul.pe.kr\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}