T

@@@@@@@@@@@이걸 어떻게 수정해야할까요?@@@@@@@@@@@

리자님이 옛날에 올린소스인데...
$before_day를 100이하로 지정하면 에러가 떠서요 ㅎ.ㅎ;


$before_day = "7";
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
$list1 = array();

$top1 = $top2 = 5;
$gr_id = "community";
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = 'news' and bo_table !='photo' and bo_table !='movie'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '{$before_time}' ";

다음소스중 wr_datetime >= '{$before_time}' "; 이게 문제인것 같네요.

원본은 http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=366 입니다.


수정된 전체 소스
[code]
<?
include_once("./_common.php");

define("_CO_INDEX_", TRUE);

include_once("./_head.php");

$before_day = "7";
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));

$list1 = array();

$top1 = $top2 = 5;
$gr_id = "community";
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = 'news' and bo_table !='photo' and bo_table !='movie'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '{$before_time}' ";

$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],36,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
}
}

$list4 = $list2;

@krsort($list2);

@ksort($list4);

$latest_skin_path = "$g4[path]/skin/latest/basic";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td height="25">
<div style="float:left"><img src="<?=$g4[path]?>/images/h_popular.gif"></div>
</td>
</tr>
<?
$i=0;
foreach($list2 as $key=>$value) {
if ($i++>=($top1)) break;
?>
<tr>
<td><img src="<?=$g4[path]?>/images/txt_num<?=$i?>.gif" hspace="6">
<?
echo $list2[$key][icon_reply] . " ";
echo "<a href='{$list2[$key][href]}'>";
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'><b>{$list2[$key][subject]}<!-- ({$list2[$key][wr_hit]}) --></b></font>";
echo "</a>";
?>
</td>
</tr>
<?
$r_i = $i;
} ?>
<?
$r_num = "5" - $r_i;
if($r_i <> ""){
for ($i=0; $i<$r_num; $i++) {
?>
<tr><td><img src="<?=$g4[path]?>/images/txt_num<?=$r_i +1?>.gif" hspace="6"> 데이터가 없습니다.</td></tr>
<? }} ?>

<? if (count($list2) == 0) { ?>
<tr><td align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">이번주 랭킹이 존재하지 않습니다.</td></tr>
<? } ?>
</table>
<?
include_once("./_tail.php");
?>
[/code]
|

댓글 8개

그게 오류가 맞다면, sql문을 이렇게
$sql2 = " select * from $g4[write_prefix]$row[bo_table] where wr_comment > -1
and wr_datetime between subdate(NOW(),interval 7 day) AND NOW() "
바꿔보세요.
테스트는 안해봤습니다. 지나가다가 자게에서 보고-_-;
아쉽게 안되네요.
관심 감사합니다.~

변경전 에러와 같습니다~ ㅎ.ㅎ
Warning: Invalid argument supplied for foreach() in /home/news/public_html/top5.php on line
$time = time();
$before_time = date("Y-m-d H:i:s", strtotime("-100 day", $time));

beforetime 계산이라면,, 위와 같이.
내일해보겠습니다~
foreach 할때 데이터가 없어서 그런거 아닌지요..

where gr_id = 'news' and bo_table !='photo' and bo_table !='movie'

이부분 잘 살펴보세요.. news 그룹에 photo & movie 를 제외한 게시판에 글이 있는지...?
그룹전체 게시판중에 포토와 무비를 제외합니다
헙헙..... DB를 보니까...... 데이터가 없어서 그런게 맞네요 ㅋㅋㅋ
다른그룹에 글을 추가해두고 안된다고 하고 있었습니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 1,510
14년 전 조회 964
14년 전 조회 814
14년 전 조회 977
14년 전 조회 1,519
14년 전 조회 951
14년 전 조회 1,031
14년 전 조회 1,057
14년 전 조회 1,452
14년 전 조회 1,582
14년 전 조회 1,005
14년 전 조회 997
14년 전 조회 1,441
14년 전 조회 1,722
14년 전 조회 840
14년 전 조회 948
14년 전 조회 968
14년 전 조회 984
14년 전 조회 949
14년 전 조회 1,154
🐛 버그신고