db에서 오늘날자 자료들만 가져올때 어떻게 하나요? 정보
db에서 오늘날자 자료들만 가져올때 어떻게 하나요?본문
db 테이블에 있는 자료를 오늘날자만 가져올려고 하는데요
어느쪽을 건드려야 할지 막막하네요... ㅠㅠ
게시판에 있는 글을 엑셀로 가져오는 소스입니다.
<?
$excel_down = "g4_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];
include "../../../dbconfig.php";
$db_conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('서버에 접속하지 못했습니다.');
mysql_select_db($mysql_db, $db_conn);
@mysql_query("SET CHARACTER SET utf8"); // 한글깨지면 주석해지
if ($ms =="excel"){
$g4[title] = "Action Item";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=ActionItem.xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
$g4[title] = "파워포인트 문서 다운로드";
header( "Content-type: application/vnd.ms-powerpoint" );
header( "Content-Disposition: attachment; filename=상품구매.ppt" );
// header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
$g4[title] = "워드 문서 다운로드";
header( "Content-type: application/vnd.ms-word" );
header( "Content-Disposition: attachment; filename=상품구매.doc" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
$g4[title] = "메모 문서 다운로드";
header( "Content-type: application/vnd.ms-notepad" );
header( "Content-Disposition: attachment; filename=상품구매.txt" );
} else {
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=상품구매.xls" );
}
header( "Content-Description: PHP4 Generated Data" );
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down ")); //where wr_is_comment = '0' and wr_content = '$wr_id' "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");// where wr_is_comment = '0' and wr_content = '$wr_id' order by wr_datetime desc");
$number=$temp[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<tr>
<td>번호</td>
<td>제목</td>
<td>파트명</td>
<td>이름</td>
<td>작성일</td>
<td>주요이슈 (주간계획/현 주요문제점/비고)</td>
<td>금일 실적</td>
<td>명일 계획</td>
<!-- 나중에 쓸 여분필드
<td>필드4</td>
<td>필드5</td>
<td>필드6</td>
<td>필드7</td>
<td>필드8</td>
<td>필드9</td>
<td>필드10</td>
-->
</tr>
<?
while($data=mysql_fetch_array($result)) {
echo "
<tr>
<td>$number</td>
<td>$data[wr_subject]</td>
<td>$data[ca_name]</td>
<td>$data[wr_name]</td>
<td class='txt'>$data[wr_datetime]</td>
<td class='txt'>$data[wr_1]</td>
<td class='txt'>$data[wr_2]</td>
<td class='txt'>$data[wr_content]</td>
</tr>
";
$number--;
}
?>
</table>
</body>
</html>
어느쪽을 건드려야 할지 막막하네요... ㅠㅠ
게시판에 있는 글을 엑셀로 가져오는 소스입니다.
<?
$excel_down = "g4_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];
include "../../../dbconfig.php";
$db_conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('서버에 접속하지 못했습니다.');
mysql_select_db($mysql_db, $db_conn);
@mysql_query("SET CHARACTER SET utf8"); // 한글깨지면 주석해지
if ($ms =="excel"){
$g4[title] = "Action Item";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=ActionItem.xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
$g4[title] = "파워포인트 문서 다운로드";
header( "Content-type: application/vnd.ms-powerpoint" );
header( "Content-Disposition: attachment; filename=상품구매.ppt" );
// header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
$g4[title] = "워드 문서 다운로드";
header( "Content-type: application/vnd.ms-word" );
header( "Content-Disposition: attachment; filename=상품구매.doc" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
$g4[title] = "메모 문서 다운로드";
header( "Content-type: application/vnd.ms-notepad" );
header( "Content-Disposition: attachment; filename=상품구매.txt" );
} else {
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=상품구매.xls" );
}
header( "Content-Description: PHP4 Generated Data" );
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down ")); //where wr_is_comment = '0' and wr_content = '$wr_id' "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");// where wr_is_comment = '0' and wr_content = '$wr_id' order by wr_datetime desc");
$number=$temp[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<tr>
<td>번호</td>
<td>제목</td>
<td>파트명</td>
<td>이름</td>
<td>작성일</td>
<td>주요이슈 (주간계획/현 주요문제점/비고)</td>
<td>금일 실적</td>
<td>명일 계획</td>
<!-- 나중에 쓸 여분필드
<td>필드4</td>
<td>필드5</td>
<td>필드6</td>
<td>필드7</td>
<td>필드8</td>
<td>필드9</td>
<td>필드10</td>
-->
</tr>
<?
while($data=mysql_fetch_array($result)) {
echo "
<tr>
<td>$number</td>
<td>$data[wr_subject]</td>
<td>$data[ca_name]</td>
<td>$data[wr_name]</td>
<td class='txt'>$data[wr_datetime]</td>
<td class='txt'>$data[wr_1]</td>
<td class='txt'>$data[wr_2]</td>
<td class='txt'>$data[wr_content]</td>
</tr>
";
$number--;
}
?>
</table>
</body>
</html>
댓글 전체
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) "));
$result=@mysql_query("select * from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) ");
확인해보세요.
$result=@mysql_query("select * from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) ");
확인해보세요.
해바리님 했는데 에러가 나네요..
오늘날자의 자료만 받아오면 되거든요
윈도우 날자에 맞쳐서 그날자에 데이타만 출력할수 있게
mysql은 정말 몰르겠네요 ㅠㅠ
그래도 해바리님 답변해주셔서 감사합니다 ㅠㅠ
오늘날자의 자료만 받아오면 되거든요
윈도우 날자에 맞쳐서 그날자에 데이타만 출력할수 있게
mysql은 정말 몰르겠네요 ㅠㅠ
그래도 해바리님 답변해주셔서 감사합니다 ㅠㅠ
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) "));
$result=mysql_query("select count(*) from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) ");
단순히 where문구만 넣었네요. 위에 내용으로 확인해보세요.
이렇게해도 에러이면 에러문구 적어보세요.
$result=mysql_query("select count(*) from $excel_down where date('Y-m-d',wr_datetime) = date('Y-m-d',time()) ");
단순히 where문구만 넣었네요. 위에 내용으로 확인해보세요.
이렇게해도 에러이면 에러문구 적어보세요.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\APM_Setup\htdocs\skin\board\todaywork2\excel.php on line 86
이렇게 나오네요 해바리님.
혹시 y-m-d 에 날자를 넣어주는건가요?
이렇게 나오네요 해바리님.
혹시 y-m-d 에 날자를 넣어주는건가요?
다른 필드를 착각했어요. 아래것으로 바꿔보세요.
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where left(wr_datetime,10)=curdate() "));
$result=mysql_query("select count(*) from $excel_down where left(wr_datetime,10)=curdate() ");
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where left(wr_datetime,10)=curdate() "));
$result=mysql_query("select count(*) from $excel_down where left(wr_datetime,10)=curdate() ");
해바리님 소스 수정해서 넣었더니 몇개 있는지만 나오네요...
윈도우 날자를 변경해서 4월6일자 검색하니 번호에 16이라고만 나오네요
4월6일 작성된 글이 16개 거든요 그런데 내용은 못가져 오나봅니다..
에구 매번 챙겨주시는데 미안해서 어떻게 해죠... ㅠㅠ
윈도우 날자를 변경해서 4월6일자 검색하니 번호에 16이라고만 나오네요
4월6일 작성된 글이 16개 거든요 그런데 내용은 못가져 오나봅니다..
에구 매번 챙겨주시는데 미안해서 어떻게 해죠... ㅠㅠ
$result=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() ");
------>
$result=mysql_query("select * from $excel_down where left(wr_datetime,10)=curdate() ");
해바리님 드디어 해결했어요 ㅠㅠ
너무 감사드려요 어찌 고마움을 표현해야 할까요... ㅠㅠ
정말 감사합니다 ^^;;
열심히 공부하도록 할게요 고마워요~
너무 감사드려요 어찌 고마움을 표현해야 할까요... ㅠㅠ
정말 감사합니다 ^^;;
열심히 공부하도록 할게요 고마워요~