엑셀로 출력할때 순서 변경하는 방법좀 문의드립니다
본문
엑셀파일로 출력을 하면 순번1이 맨아래로 가는데요
1번부터 나오도록 할려고 하니 db쪽이라 막히네요 흠...
<?
$g4_path = "../../..";
include_once("$g4_path/common.php");
$excel_down = "g4_write_" . $bo_table;
@mysql_query("SET CHARACTER SET utf8"); // 한글깨지면 주석해지
if ($ms =="excel"){
$g4[title] = "excel";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=excel.xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else {
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=excel.xls" );
}
header( "Content-Description: PHP4 Generated Data" );
/* 날자지정 출력 가능 (해바리님 소스)
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where left(wr_datetime,10)='$datetime' "));
$result=mysql_query("select * from $excel_down where left(wr_datetime,10)='$datetime' ");
*/
/* 날자지정 출력 가능(단 서버에서만!)
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where left(wr_datetime,10)=curdate() "));
$result=mysql_query("select * from $excel_down where left(wr_datetime,10)=curdate() ");
*/
$temp=mysql_fetch_array(mysql_query("select * from table where datetime_col = curdate(); $excel_down "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");
$number=$temp[0];
?>
도움좀 요청드립니다~
답변 1
정말 간단한 문의 였네요... ㅎ
$temp=mysql_fetch_array(mysql_query("select * from table where datetime_col = curdate(); $excel_down "));
$result=@mysql_query("select * from $excel_down order by wr_datetime asc");
desc 와 asc에 차이네요 ^^
혹시 sql문 관련 참고할 사이트 있으면 알려주세요 ㅠㅠ
답변을 작성하시기 전에 로그인 해주세요.