메뉴 건너뛰기

프로그램언어

조회 수 4798 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

접속된 DB의 설정된 테이블의 모든 데이터를 엑셀 파일로 다운로드 받는 소스 입니다.
===================================================
<?
$connect_host        = "localhost";
$connect_id        = "DB아이디";
$connect_pass        = "DB비밀번호";
$connect_db        = "DB이름";
$connect_table        = "테이블이름";
$xls_filename        = "filename.xls";

$connect=@mysql_connect($connect_host,$connect_id,$connect_pass);
$mysql=@mysql_select_db($connect_db,$connect);

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$xls_filename");
?> 

<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=EUC-KR>
</head>
<body>
<table border=1>
<tr align=center>
<?
$fields = mysql_list_fields("$connect_db", "$connect_table");
$columns = mysql_num_fields($fields);

for ($i = 0; $i < $columns; $i++) {
$field[$i]=mysql_field_name($fields, $i);
  echo "<th>".$field[$i]. "</th>";
}
?>
</tr>

<?
$result=mysql_query("select * from $connect_table");
while($data=mysql_fetch_assoc($result)){
echo"<tr>";

for ($i = 0; $i < sizeof($field); $i++) {
echo "<td>".$data["$field[$i]"]."</td>";
}

echo"</tr>";
}
?>
</table>
</body>
</html>  



  1. MYSQL DB 다중접속을 해결 하는 한 방법

    Date2021.03.26 Views284
    Read More
  2. MySQL DB 중복여부 검사하여 없는 것만 추가

    Date2015.04.14 Views20157
    Read More
  3. MYSQL DB의 모든 테이블에서 문자열 검색 하기

    Date2021.03.26 Views915
    Read More
  4. MYSQL 업데이트 두 번 하기

    Date2014.02.27 Views19729
    Read More
  5. mysql 에러 구문 표시

    Date2014.02.27 Views20349
    Read More
  6. MySQL(MariaDB) 테이블 만들기

    Date2018.03.28 Views8154
    Read More
  7. mysql_affected_rows — 최근 MySQL 작업으로 변경된 행 개수를 얻음

    Date2016.12.23 Views18807
    Read More
  8. mysql_free_result(); 관련 오류

    Date2021.03.25 Views353
    Read More
  9. mysql_insert_id

    Date2016.12.23 Views18752
    Read More
  10. mysql_real_escape_string 이진 데이터를 입력할 경우 이 함수를 사용해야 함

    Date2016.12.23 Views18640
    Read More
  11. mysql_result — 결과 데이터를 반환

    Date2016.12.23 Views18967
    Read More
  12. MySQL테이블의 내용을 엑셀파일(xls)로 다운로드 하기

    Date2018.07.24 Views4798
    Read More
  13. parse_ini_file — Parse a configuration file

    Date2016.12.23 Views19774
    Read More
  14. PEAR DB 관련 함수들

    Date2021.03.26 Views690
    Read More
  15. PHP $_SERVER 함수

    Date2019.02.25 Views1558
    Read More
  16. PHP + 유튜브(youtube) 동영상 업로드 연동 소스

    Date2021.01.21 Views1143
    Read More
  17. PHP - 공공 DATA XML 파싱(PHP 버전)

    Date2023.01.12 Views270
    Read More
  18. PHP continue 문

    Date2015.04.14 Views21097
    Read More
  19. php date 날짜 관련 함수

    Date2021.03.27 Views413
    Read More
  20. PHP eregi가 빠를까, strpos가 빠를까?

    Date2018.10.27 Views4091
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved