¾ÆÀ̵ð ºñ¹Ð¹øÈ£ | ȸ¿ø°¡ÀÔ | ºñ¹Ð¹øÈ£ºÐ½Ç
   
¡¡»õ·Î¿î¼Ò½Ä
¡¡FAQ
¡¡À¥ÇÁ·Î±×·¥
¡¡À¥DB
¡¡À¥¼­¹ö
¡¡À¥ÇÁ·Î±×·¥¼öÁ¤
¡¡ÇØÇÇÄ®·³
¡¡°ñµåÆÁ
 
Á¦ÀÛÀÇ·Ú
À¥ÇÁ·Î±×·¥ ÆǸŸô
 
ÇöÀçÀ§Ä¡: ¸ÞÀÎ ÇØÇÇÆ÷·³ À¥µðºñ : °Ô½Ã¹° Àбâ
  2002-07-31 (22:54:51) from 61.104.186.59
  ÀÛ¼ºÀÎ : HappyCGI Á¶È¸¼ö : 5971   
Á¦¸ñ : Re: DB ¸ÖƼ°Ë»öÀ» ÇÏ·Á°í Çϴµ¥..

"lotus74" ´Ô Àοë±Û
¾È³çÇϼ¼¿ä.

±×¾ß¸»·Î Á×À»¸ÀÀÔ´Ï´Ù. -_-;

PERL°ú msql ¿¬µ¿ÇÏ¿© »ç¿ëÁßÀÌ¿¹¿ä..

¿ì¸®°¡ ÈçÈ÷ º¸´Â °Ë»öÇϱ⿡¼­
¸ÖƼ°Ë»öÀ» ÇÏ·Á°í ÇÕ´Ï´Ù.
talbe¿¡¼­
»óÅ°¡ *(¸ðµÎ),A,B,B,DÀÎ °æ¿ì¿¡ ´ëÇØ ¸ÖƼ°Ë»öÀ»ÇÏ·Á±¸¿ä.
¿¹Àü¿¡´Â radio¹öÆ°À» »ç¿ëÇÏ¿© ÇÑ°¡Áö °æ¿ì¿¡¸¸ °Ë»öÀ» Çß¾ú´Âµ¥
checkbox¸¦ »ç¿ëÇÏ¿© ¿©·¯°æ¿ì¿¡ ´ëÇØ °Ë»öÀÌ °¡´ÉÇÏ°Ô ÇÏ·Á±¸¿ä.

±×·±µ¥..
º»·¡ÀÇ cgi¼Ò½º¸¦ º¸¾Æµµ ¸ð¸£°Ú°í..
°ü·ÃµÈ ¼Ò½º¸¦ ãÀ» ¼öµµ ¾ø³×¿ä.

°£´ÜÇÑ ÆÁÀÌ¶óµµ ÁÖ½Ã¸é °¨»çÈ÷ ¹Þ°Ú½À´Ï´Ù.




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

perlÀ» ÀÌ¿ëÇÏ½Å´Ù´Ï ¹Ý°©½À´Ï´Ù.  ¿Õ¿ôÀ½~

°£´ÜÇÑ ¿¹Á¦¸¦ µé¾îº¸°Ú½À´Ï´Ù.

[ÇÁ·Î±×·¥ÄÚµå]
select * from test_DB where name like 'ÇÏÀÌ%' ;


À§ ¿¹Á¦´Â test_DB Áß name Ä÷³¿¡¼­ ÇÏÀÌ ¿Í ºñ½ÁÇÑ°ÍÀ» ã¾Æ¶óÁÒ (¾Æ½Ã°ÚÁö¸¸)

ÆÞÀ» ¾²½Å´Ù¸é ¾Æ¸¶ ¾Æ·¡¿Í À¯»çÇÑ ¹®¹ýÀ» ¾²½Ç°Çµ¥¿ä.

[ÇÁ·Î±×·¥ÄÚµå]
$sth = $dbh->prepare("select * from test_DB where name like 'ÇÏÀÌ%' ");


üũ¹Ú½ºÀÇ name °ªÀ» ¿¹¸¦ µé¾î A,B,C¶ó°í ÇÕ´Ï´Ù.
±×¸®°í A ¿¡ °ªÀ» a, BÀÇ °ªÀ» b,CÀÇ °ªÀ» c ¶ó°í °¡Á¤Çϱ¸¿ä.
A´Â À̸§Çʵå(name), B´Â ³ªÀÌÇʵå(age),C´Â Ãë¹ÌÇʵå(hobby)¶ó°í °¡Á¤ÇÕ´Ï´Ù.
$a ´Â AÀÇ °ªÀÎ a¸¦ ,$b´Â BÀÇ °ªÀÎ b¸¦ ,$c ´Â CÀÇ °ªÀÎ c ¶ó°í °¡Á¤Çϱ¸¿ä.


¸¸¾à »ç¿ëÀÚ°¡ A,B¸¦ ¼±ÅÃÇß´Ù¸é(¶Ç ´Ù¸¥ ¹æ¹ýÀ¸·Îµµ ok)
±×¸®°í °Ë»ö´Ü¾î°¡ ÇØÇÇCGI ¶ó¸é ¾Æ·¡ ó·³ ¹®¹ýÀÌ µÇ¾î¾ß °Ú½À´Ï´Ù.

[ÇÁ·Î±×·¥ÄÚµå]
if ($a) {
$a_search = " name like '%ÇØÇÇCGI%' or ";
}
if ($b) {
$b_search = " age like '%ÇØÇÇCGI%' or ";
}
if ($c) {
$c_search = " hobby like '%ÇØÇÇCGI%' ";
}

$sth = $dbh->prepare("select * from test_DB where $a_search $b_search $c_search  ");

$sth->execute();



À§ ó·³ ÇÏ°Ô µÇ¸é °£´ÜÈ÷ ¸ÖƼÄ÷³ÀÇ °Ë»öÀÌ µÇ°ÚÁö¿ä?

´Ù¸¥ ¹æ¹ýµµ ¸¹°ÚÁö¸¸ (¿¹¸¦ µé¸é °¢ A,B,CÀÇ name°ªÀ» ´Ù½Ã º¯¼ö·Î Àâ¾Æ¼­ Äڵ带 ´õ °£´ÜÈ÷ ¸¸µå´Â ¹æ¹ý)

Á¦ÀÏ ¹«½ÄÇÏ°Ô ¸¸µé¾î ºÃ½À´Ï´Ù.  ¶¡~

$a_search ,$b_search , $c_search °¡ ¸ðµÎ ¾ø´Â °æ¿ì¿¡´Â ¹®¹ý¿À·ù°¡ ³ª°ÚÁö¿ä?

ÆÞ·Î °£´ÜÈ÷ ¸·À¸½Ã¸é µÉ°Í °°±¸¿ä.

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


HappyCGI's SIGN
°³¹ßÀÚÀÇ ¹Ì´öÀº

°ÔÀ¸¸§(Laziness)
ÂüÁö¸»±â(Impatience)
±³¸¸(Hubris)


   ¸Þ¸ð

³²°ÜÁø ¸Þ¸ð°¡ ¾ø½À´Ï´Ù.

:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~

  

 
¨Ô
Á¦¸ñ
ÀÛ¼ºÀÎ
Á¶È¸
µî·ÏÀÏ
DB ¸ÖƼ°Ë»öÀ» ÇÏ·Á°í Çϴµ¥..
lotus74
6169
2002-07-30
Re: DB ¸ÖƼ°Ë»öÀ» ÇÏ·Á°í Çϴµ¥..
HappyCGI
5972
2002-07-31
 



  HOME | ȸ»ç¼Ò°³ | Á¦ÀÛÀÇ·Ú | °³ÀÎÁ¤º¸Ãë±Þ¹æħ | CGIMALL | ÀÚ·á½Ç | »çÀÌÆ®µî·Ï | ·©Å·100 | Æ÷·³ | Ãʺ¸°¡À̵å | Áú¹®°ú´äº¯ | ¹è³Ê±¤°í
Copyright¨Ï1997~2008 HappyCGI All rights reserved
Powered By HappyCGI