AUTO
[ID/PWã±â] [ȸ¿ø°¡ÀÔ]
´º½º¿Í Á¤º¸ (276)
ÀÚÀ¯ °Ô½ÃÆÇ (392)
°¡ÀÔ Àλç (1960)
°øÁö»çÇ× (5)
AJAX ÇнÀ (72)
ASP Áú¹® (71)
ASP ÇнÀ (271)
MYSQL ÇнÀ (73)
SQLSERVER ÇнÀ (337)
¿À¶óŬ ÇнÀ (66)
µ¥ÀÌŸº£À̽º ÇнÀ (29)
¾×¼Ç½ºÅ©¸³Æ® ÇнÀ (261)
¾×¼Ç½ºÅ©¸³Æ® Áú¹® (65)
ÆÛ¿Â Ç÷¡½Ã (204)
Ç÷¡½Ã ³×ºñ°ÔÀÌ¼Ç (59)
Ç÷¡½Ã ¼Ò½º (532)
Ç÷¡½Ã ¿¬±¸½Ç (536)
Ç÷¡½Ã Áú¹® (647)
Ç÷¡½Ã °ÔÀÓ (53)
Ç÷¡½Ã ÀÎÆ®·Î (44)
Ç÷¡½Ã ÀÌÆåÆ® (45)
ÀÚÀÛ Ç÷¡½Ã (83)
ű×,HTML Áú¹® (43)
ű×,HTML ÇнÀ (131)
ÀÚ¹Ù,JSP ÇнÀ (161)
ÀÚ¹Ù,JSP Áú¹® (70)
ÀÚ¹Ù½ºÅ©¸³Æ® ÇнÀ (223)
ÀÚ¹Ù½ºÅ©¸³Æ® ¼Ò½º (73)
ÀÚ¹Ù½ºÅ©¸³Æ® Áú¹® (79)
Æ÷Åä¼¥ Áú¹® (108)
Æ÷Åä¼¥ ÇнÀ (369)
Ãßõ À̹ÌÁö (239)
ÀÚÀÛ À̹ÌÁö (81)
ÆÛ¿Â À̹ÌÁö (445)
PHP Áú¹® (62)
PHP ÇÔ¼ö (2658)
PHP ÇнÀ (661)
ÇÁ·Î±×·¡¹Ö ÇнÀ (205)
ÀÎÅͳݼ­¹ö ÇнÀ (346)
ÀÎÅͳݼ­¹ö Áú¹® (22)
³×À̹ö ¼Ó ȨÇǵðÀÚÀδåÄÄ
´ÙÀ½ ¼Ó ȨÇǵðÀÚÀδåÄÄ
±¸±Û ¼Ó ȨÇǵðÀÚÀδåÄÄ
¿¥ÆÄ½º ¼Ó ȨÇǵðÀÚÀδåÄÄ
¾ßÈÄ ¼Ó ȨÇǵðÀÚÀδåÄÄ
³×ÀÌÆ® ¼Ó ȨÇǵðÀÚÀδåÄÄ
½ÎÀÌ¿ùµå ȨÇǵðÀÚÀδåÄÄ
¿¥¿¡½º¿£ ȨÇǵðÀÚÀδåÄÄ
  ȨÇǵðÀÚÀδåÄÄ > PHP ÇÔ¼ö
   
  mysqli_select_db
  ±Û¾´ÀÌ : ¼Õ´Ô     ³¯Â¥ : 06-01-21 08:05     Á¶È¸ : 825    
   http://cafe.naver.com/q69/11495 (142)

mysqli_select_db

(PHP 5)

mysqli_select_db

(no version information, might be only in CVS)

mysqli->select_db -- Selects the default database for database queries

Descript-xion

bool mysqli_select_db ( object link, string dbname)

The mysqli_select_db() function selects the default database (specified by the dbname parameter) to be used when performing queries against the database connection represented by the link parameter.

Âü°í: This function should only be used to change the default database for the connection. You can select the default database with 4th parameter in mysqli_connect().

Return values

¼º°øÀÏ °æ¿ì TRUE¸¦, ½ÇÆÐÀÏ °æ¿ì FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù.

Example

¿¹ 1. Object oriented style

<?php
$mysqli
= new mysqli("localhost", "my_user", "my_password", "test"
);

/* check connection */
if (mysqli_connect_errno
()) {
  
printf("Connect failed: %s\n", mysqli_connect_error
());
   exit();
}

/* return name of current default database */
if ($result = $mysqli->query("SELECT DATABASE()"
)) {
  
$row = $result->fetch_row
();
  
printf("Default database is %s.\n", $row[0
]);
  
$result->close
();
}

/* change db to world db */
$mysqli->select_db("world"
);

/* return name of current default database */
if ($result = $mysqli->query("SELECT DATABASE()"
)) {
  
$row = $result->fetch_row
();
  
printf("Default database is %s.\n", $row[0
]);
  
$result->close
();
}

$mysqli->close
();
?>

¿¹ 2. Procedural style

<?php
$link
= mysqli_connect("localhost", "my_user", "my_password", "test"
);

/* check connection */
if (mysqli_connect_errno
()) {
  
printf("Connect failed: %s\n", mysqli_connect_error
());
   exit();
}

/* return name of current default database */
if ($result = mysqli_query($link, "SELECT DATABASE()"
)) {
  
$row = mysqli_fetch_row($result
);
  
printf("Default database is %s.\n", $row[0
]);
  
mysqli_free_result($result
);
}

/* change db to world db */
mysqli_select_db($link, "world"
);

/* return name of current default database */
if ($result = mysqli_query($link, "SELECT DATABASE()"
)) {
  
$row = mysqli_fetch_row($result
);
  
printf("Default database is %s.\n", $row[0
]);
  
mysqli_free_result($result
);
}

mysqli_close($link
);
?>

The above examples would produce the following output:

Default database is test.
Default database is world.


add a note add a note User Contributed Notes
mysqli_select_db
miguel dot simoes at almadanet dot com
22-Sep-2004 01:02
When using Zend Compatibility Mode, you'll not be able to use MySQLi as you would like. Each time you try to create a new object you'll get:

"Fatal error: Trying to clone an uncloneable object of class mysqli in XXX".

In order to use the mysqli objects you'll need to deactivate Zend Compatibility mode before calling the connect procedure:

ini_set('zend.ze1_compatibility_mode', 0);
$mysqli = new mysqli(hostname,username,password,[database]);

** Issue happening under Unix and Windows OS.

   

 
´º½º¿Í Á¤º¸ ¡¤ ÀÚÀ¯ °Ô½ÃÆÇ ¡¤ °¡ÀÔ ÀÎ»ç ¡¤ °øÁö»çÇ× ¡¤ AJAX ÇнÀ ¡¤ ASP Áú¹® ¡¤ ASP ÇнÀ ¡¤ MYSQL ÇнÀ ¡¤ SQLSERVER ÇнÀ ¡¤ ¿À¶óŬ ÇнÀ ¡¤ µ¥ÀÌŸº£À̽º ÇнÀ ¡¤ ¾×¼Ç½ºÅ©¸³Æ® ÇнÀ ¡¤ ¾×¼Ç½ºÅ©¸³Æ® Áú¹® ¡¤ ÆÛ¿Â Ç÷¡½Ã ¡¤ Ç÷¡½Ã ³×ºñ°ÔÀÌ¼Ç ¡¤ Ç÷¡½Ã ¼Ò½º ¡¤ Ç÷¡½Ã ¿¬±¸½Ç ¡¤ Ç÷¡½Ã Áú¹® ¡¤ Ç÷¡½Ã °ÔÀÓ ¡¤ Ç÷¡½Ã ÀÎÆ®·Î ¡¤ Ç÷¡½Ã ÀÌÆåÆ® ¡¤ ÀÚÀÛ Ç÷¡½Ã ¡¤ ű×,HTML Áú¹® ¡¤ ű×,HTML ÇнÀ ¡¤ ÀÚ¹Ù,JSP ÇнÀ ¡¤ ÀÚ¹Ù,JSP Áú¹® ¡¤ ÀÚ¹Ù½ºÅ©¸³Æ® ÇнÀ ¡¤ ÀÚ¹Ù½ºÅ©¸³Æ® ¼Ò½º ¡¤ ÀÚ¹Ù½ºÅ©¸³Æ® Áú¹® ¡¤ Æ÷Åä¼¥ Áú¹® ¡¤ Æ÷Åä¼¥ ÇнÀ ¡¤ Ãßõ À̹ÌÁö ¡¤ ÀÚÀÛ À̹ÌÁö ¡¤ ÆÛ¿Â À̹ÌÁö ¡¤ PHP Áú¹® ¡¤ PHP ÇÔ¼ö ¡¤ PHP ÇнÀ ¡¤ ÇÁ·Î±×·¡¹Ö ÇнÀ ¡¤ ÀÎÅͳݼ­¹ö ÇнÀ ¡¤ ÀÎÅͳݼ­¹ö Áú¹®¡¤ Ç÷¡½Ã »ùÇà ¼Ò½º ¡¤ Ç÷¡½Ã äÆÃ¹æ ¡¤ Ç÷¡½Ã ¹Ì´ÏȨÇÇ ¡¤ Ç÷¡½Ã °¶·¯¸® ¡¤ Ç÷¡½Ã RSS¸®´õ ¡¤ Ç÷¡½Ã PHP »çÀü ¡¤ Ç÷¡½Ã ¿ìÆí¹øÈ£ ã±â ¡¤ Ç÷¡½Ã ÇÑÀÚ°ÔÀÓ ¡¤ Ç÷¡½Ã ´Þ·Â°ú½Ã°è ¡¤ Ç÷¡½Ã Æ÷Åä¶óÀ̺귯¸® ¡¤ ·£´ýÀ̹ÌÁö ¡¤ Ç÷¡½Ã ´Þ·Â°ú½Ã°è ¡¤ ÇÑ±Û µµ¸ÞÀÎ ¡¤ ³×À̹ö ºí·Î±× ½ºÅ©·¦ ¡¤ ½ÎÀÌ¿ùµå ¹Ì´ÏȨÇÇ °¶·¯¸® ¡¤ ½ÎÀÌ¿ùµå ¹Ì´ÏȨÇÇ µî·Ï ¡¤ ÇÁ·Î°ÔÀÌ¸Ó ·©Å© ¡¤ ȨÆäÀÌÁöÁ¤º¸ ºí·Î±×
Copyright ¨Ï hompy.info. All rights reserved.