채택완료

엑셀로 출력할때 순서 변경하는 방법좀 문의드립니다

2014-06-10 (화) 15:51:04 5,918
엑셀파일로 출력을 하면 순번1이 맨아래로 가는데요
 
1번부터 나오도록 할려고 하니 db쪽이라 막히네요 흠...
 
Copy
<?$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개

채택된 답변
+20 포인트
2014-06-10 (화) 16:10:05
정말 간단한 문의 였네요... ㅎ
 
Copy
$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문 관련 참고할 사이트 있으면 알려주세요 ㅠㅠ

답변을 작성하려면 로그인이 필요합니다.