½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > Ä¿¹Â´ÏƼ > Áú¹®°ú´äº¯ »ó¼¼º¸±â
Ä¿¹Â´ÏƼ ±¸Àα¸Á÷
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
javascript
PHP
ASP
CSS
mysql
html
jquery
������
image
mobile
API
slide
°Ô½ÃÆÇ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
°Ô½ÃÆÇŸÀÌƲ Áú¹®°ú´äº¯ / »ó¼¼º¸±â
Æ®À§ÅÍ·Î º¸³»±â
Ãßõ¼ö 135 | Á¶È¸¼ö 2,092 | µî·ÏÀÏ 2004-11-23 22:15:00

´Ð³×ÀÓ

HappyCGI

À̸ÞÀÏ

webmaster@happycgi.com

Á¦¸ñ

[´äº¯] ¼Ò½º¼öÁ¤Á»...
³»¿ë
[¹ÚÈÆÀÌ´Ô ¿øº»±Û]

±×·³ Àú ¹Ø¿¡ ¼Ò½º¿¡¼­ Á¦°¡ °íÃľßÇϴºκи¸ »ö°¥·Î Ç¥½Ã¸¦ ÇØ ÁֽǼö´Â ¾ø³ª¿ä? ¸¸¾à¿¡ db°¡ 1ÀÌ°í dbºñ¹øÀÌ2¶ó°í°¡Á¤Çϱ¸¿ä... Á¦°¡ Ãʺ¸¶ó ¿°Ä¡ºÒ±¸ÇÏ°í ºÎŹÀ» µå¸²´Ï´Ù...

 

<?
 // ÀÛ¼ºÀÚ : ÃÖ»ó¹Î
 // ¼öÁ¤ÀÏ : 2002³â 2¿ù 17ÀÏ
 // ÆÄÀϸí : dbConnect.php
 // µ¥ÀÌÅÍ º£À̽º ¿¬°á Ŭ·¡½º


  class dbConnect {
  var $host;
  var $user;
  var $pass;
  var $db;
  var $conn = false;


  // ÀϹݿ¬°áÀ» À§ÇÑ »ý¼ºÀÚ
  function dbConnect($host, $user, $pass, $db) {
   $this->host = $host;
   $this->user = $user;
   $this->pass = $pass;
   $this->db = $db;
   $this->conn = mysql_connect($host, $user, $pass) or die("MySQL¿¬°á¿¡ ½ÇÆÐÇß½À´Ï´Ù. °ü¸®ÀÚ¿¡°Ô ¹®Àǹٶø´Ï´Ù.");
   if(!mysql_select_db($db, $this->conn)) {
    echo "µ¥ÀÌÅÍ º£À̽º ¿¬°á¿¡ ÀÌ»óÀÌ ÀÖ½À´Ï´Ù. °ü¸®ÀÚ¿¡°Ô ¹®Àǹٶø´Ï´Ù.";
    exit();
   }
   return 1;
  }
  
  // Ä¿³Ø¼Ç °¡Á®¿À±â
  function getConnection() {
   return $this->conn;
  }

  function runQuery($query) {
   if($this->conn)
    return mysql_query($query, $this->conn);
   else {
    echo "µ¥ÀÌÅÍ º£À̽º ¿¬°áÀ» ÇÏÁö ¾Ê¾Ò½À´Ï´Ù.";
    exit();
   }
  }

  // µ¥ÀÌÅͺ£À̽º ´Ý±â
  function closeConnection() {
   return mysql_close($this->conn)?1:0;
  }
 }

 //================================== »ç¿ëÀÚÀÇ È¯°æ¿¡ ¸Â°Ô ¹Ýµå½Ã ¼öÁ¤ÇØÁֽʽÿä ====================================================//
 $host = "localhost";     // Host
 $user = "sad2sang";    // User
 $pass = "sad2sang";    // Password
 $db = "sad2sang";     // Database
 $conn = new dbConnect($host, $user, $pass, $db);
?>

 

ÇØÇÇCGI ÀÔ´Ï´Ù.

¾Æ·¡ ¼öÁ¤ÇÏ¼Å¾ß ÇÒ ºÎºÐÀÔ´Ï´Ù.


[ÇÁ·Î±×·¥ÄÚµå]

 $host = "localhost";     // Host
 $user = "sad2sang";    // User
 $pass = "sad2sang";    // Password
 $db = "sad2sang";     // Database



$hostÀÇ °æ¿ì º¸Åë  localhost À̱¸¿ä.
$user ´Â mysqlÀÇ  user
$pass ´Â mysql password
$db ´Â mysqlÀÇ DB¸íÀÔ´Ï´Ù.

ÁÁÀº ÇÏ·çµÇ¼¼¿ä.

Ãßõ½ºÅ©·¦¼Ò½ºº¸±â ¸ñ·Ï
ÀÌÀü°Ô½Ã±Û ¼Ò½º¼öÁ¤Á»... 2004-11-20 13:49:54
´ÙÀ½°Ô½Ã±Û À¯·á ¼Ò½º¿¡ ´ëÇؼ­.. 2004-11-30 00:03:00