[quote:a177d9b224="lotus74"]¾È³çÇϼ¼¿ä.
±×¾ß¸»·Î Á×À»¸ÀÀÔ´Ï´Ù. -_-;
PERL°ú msql ¿¬µ¿ÇÏ¿© »ç¿ëÁßÀÌ¿¹¿ä..
¿ì¸®°¡ ÈçÈ÷ º¸´Â °Ë»öÇϱ⿡¼
¸ÖƼ°Ë»öÀ» ÇÏ·Á°í ÇÕ´Ï´Ù.
talbe¿¡¼
»óÅ°¡ *(¸ðµÎ),A,B,B,DÀÎ °æ¿ì¿¡ ´ëÇØ ¸ÖƼ°Ë»öÀ»ÇÏ·Á±¸¿ä.
¿¹Àü¿¡´Â radio¹öÆ°À» »ç¿ëÇÏ¿© ÇÑ°¡Áö °æ¿ì¿¡¸¸ °Ë»öÀ» Çß¾ú´Âµ¥
checkbox¸¦ »ç¿ëÇÏ¿© ¿©·¯°æ¿ì¿¡ ´ëÇØ °Ë»öÀÌ °¡´ÉÇÏ°Ô ÇÏ·Á±¸¿ä.
±×·±µ¥..
º»·¡ÀÇ cgi¼Ò½º¸¦ º¸¾Æµµ ¸ð¸£°Ú°í..
°ü·ÃµÈ ¼Ò½º¸¦ ãÀ» ¼öµµ ¾ø³×¿ä.
°£´ÜÇÑ ÆÁÀÌ¶óµµ ÁÖ½Ã¸é °¨»çÈ÷ ¹Þ°Ú½À´Ï´Ù.[/quote:a177d9b224]
ÇØÇÇ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 °¡ ¸ðµÎ ¾ø´Â °æ¿ì¿¡´Â ¹®¹ý¿À·ù°¡ ³ª°ÚÁö¿ä?
ÆÞ·Î °£´ÜÈ÷ ¸·À¸½Ã¸é µÉ°Í °°±¸¿ä.
ÁÁÀº ÇÏ·çµÇ¼¼¿ä.