BACKRUSH  À¯´Ð½º¸í·É  ´ÙÀ½  ÀÚ·á½Ç  Ascii Table   ¿ø°ÝÁ¢¼Ó  ´Þ·Â,½Ã°£   ÇÁ·Î¼¼½º   ½©
ÁöÇÏö³ë¼±   RFC¹®¼­   SUN FAQ   SUN FAQ1   C¸Þ´º¾ó   PHP¸Þ´º¾ó   ³Ê±¸¸®   ¾Æ½ºÅ°¿ùµå ¾ÆÀÌÇǼ­Ä¡

±Û¾´ÀÌ: aaaa CSVÆÄÀÏ·Î ÀúÀåÇϱâ[PHP] Á¶È¸¼ö: 14438


<?
include "ȯ°æ ¼³Á¤ ÆÄÀϵé";

// DB¸¦ Á¤ÀÇÇÕ´Ï´Ù. ¿©±â¼­´Â DB Ŭ·¡½º ÆÄÀÏÀ» includeÇؼ­ »ç¿ëÇß½À´Ï´Ù.
$DB = new DB_Mysql($WEB_HOST,$WEB_USER,$WEB_PASS,$WEB_DB);

// ³»º¸³¾ µ¥ÀÌÅ͸¦ °¡Á®¿É´Ï´Ù.
$sql = "select * from Å×À̺í¸í order by idx desc";
$DB->query($sql);

// CSV ÆÄÀÏ ÃÖ»ó´Ü¿¡ Ç¥±â ÇÒ ³»¿ëÀÔ´Ï´Ù.
$csv_dump .= "ID,UID,¹ß¼ÛÀÚ,¹ß¼ÛÀÚ¸ÞÀÏÁÖ¼Ò,¼ö½ÅÀÚID,¼ö½ÅÀÚUID,¼ö½ÅÀÚ¸ÞÀÏÁÖ¼Ò,¸ÞÀÏÁÖ¼Ò°ø°³¿©ºÎ,¸ÞÀϳ»¿ë,¹ß¼Û³¯Â¥,";
$csv_dump .= "\r\n";

// while ·Î µ¥ÀÌÅ͸¦ º¯¼ö¿¡ ¾µ¾î ³Ö½À´Ï´Ù -_-;
while ($row = $DB->fetch_array()) {

// CSVÀúÀå ½Ã CR+LF ¹× , Ç¥½Ã°¡ ÀÖÀ¸¸é ¾ÈµÇ¹Ç·Î ġȯ½Ãŵ´Ï´Ù.
$row[mail_txt] = str_replace("\r\n","",$row[mail_txt]);
$row[mail_txt] = str_replace(","," ",$row[mail_txt]);

// Çà °ªÀ» csv_dump ¿¡ ¾µ¾î´ã½À´Ï´Ù -_-;
$csv_dump .= $row[UserID].",";
$csv_dump .= $row[UserUID].",";
$csv_dump .= $row[send_char].",";
$csv_dump .= $row[send_mail].",";
$csv_dump .= $row[re_UserID].",";
$csv_dump .= $row[re_UserUID].",";
$csv_dump .= $row[re_mail].",";
$csv_dump .= $row[mailagree].",";
$csv_dump .= $row[mail_txt].",";
$csv_dump .= $row[regdate].",";
$csv_dump .= "\r\n";

} // while¹® Á¾·á

// CSV ÆÄÀÏ·Î ÀúÀåÇÕ´Ï´Ù. ÆÄÀϸíÀ» ³¯Â¥¸¦ ºÙ¿© »ý¼ºÇÕ´Ï´Ù.
$date = date("YmdHi");
$filename = "csvoutput_".$date.".csv";

header( "Content-type: application/vnd.ms-excel;charset=KSC5601" );
header("Content-Disposition: attachment; filename=$filename");
header( "Content-Description: PHP4 Generated Data" );

echo $csv_dump;

$DB->close();
?>



°ü·Ã±Û : ¾øÀ½ ±Û¾´½Ã°£ : 2009/10/25 0:32 from 125.141.52.247

  Çѱ۱úÁü ó¸® ¸ñ·Ïº¸±â »õ±Û ¾²±â Áö¿ì±â ÀÀ´ä±Û ¾²±â ±Û ¼öÁ¤ phpÀ¸·Î ÀÛ¾÷°ü¸®ÀÚ¸¦ ¸¸µé·Á°í Çϴµ¥¿ä  
BACKRUSH  À¯´Ð½º¸í·É  ´ÙÀ½  ÀÚ·á½Ç  Ascii Table   ¿ø°ÝÁ¢¼Ó  ´Þ·Â,½Ã°£   ÇÁ·Î¼¼½º   ½©
ÁöÇÏö³ë¼±   RFC¹®¼­   SUN FAQ   SUN FAQ1   C¸Þ´º¾ó   PHP¸Þ´º¾ó   ³Ê±¸¸®   ¾Æ½ºÅ°¿ùµå ¾ÆÀÌÇǼ­Ä¡