날자가 뒤죽박죽 되어서 이거 날자 정렬 관련
본문
f_datestr 에 날자가 정렬이 맞지 않아서 이거 정렬을 하려면 어떻게 처리를 해야 할까요
혹시 몰라서 소스 올려 드립니다
<?php
$daesu = htmlentities($daesu);
//$fcode = htmlentities($fcode);
$nowpage = htmlentities($nowpage);
$totalpage = htmlentities($totalpage);
$c_code = htmlentities($c_code);
$mode = htmlentities($mode);
$cont = htmlentities($cont);
if($cont != "yes") {
$totalrec = 0;
$qry = "select f_name1 from tbl_speaker where f_mcode = '".$c_code."'";
$rs = @mysql_query($qry);
if(!$rs) {
print("<br /><br /><center>발언자를 검색하는 중에 에러가 발생했습니다(1).</center>");
}
$totalrec = @mysql_num_rows($rs);
} /* end of nextpage */
if($totalrec > 0) {
if(!$nowpage) {
$nowpage = 1;
}
$totalpage = ceil($totalrec / 10);
$blockpage = floor(($nowpage - 1) / 10) +1;
$startpage = ($blockpage - 1) * 10 + 1;
$endpage = $blockpage * 10;
if($totalpage < $endpage) {
$endpage = $totalpage;
}
$firstrec = ($nowpage - 1) * 10;
$cnt = $totalrec - $firstrec;
if($cnt > 10) {
$cnt = 10;
}
$i = $firstrec;
$qry = "select * from tbl_speaker where f_mcode = '".$f_code."' order by f_th desc,f_code asc,f_cha asc limit ".$firstrec.", ".$cnt;
$rs = mysql_query($qry);
if(!$rs) {
print("<br /><br /><center>발언자를 검색하는 중에 에러가 발생했습니다(2).</center>");
}
while($row = mysql_fetch_array($rs)) {
$no = $totalrec - $i;
$i++;
$mname = urlencode($row[f_name1]."-".$row[f_name2]);
$row[f_etc1] = str_replace("유성구의회", "", $row[f_etc1]);
// 2019-09-26 js
if($row[f_cha] == 0 || $row[f_cha] == 99) {
$f_th = "제".$row[f_th]."회";
}
else {
if(strchr($row[f_code], "H")) {
$f_th = $row[f_th]."년도 행정사무감사";
}
else {
$f_th = "제".$row[f_th]."회";
}
}
$strTh = $f_th." ".$row[f_chastr]." ".$row[f_etc1]."(".$row[f_datestr].")";
$qryan = "select * from tbl_angun where f_file = '".$row[f_file]."' order by f_angunno asc";
$rsan = mysql_query($qryan);
if(!$rsan) {
print "<br /><br /><br /><center><b>데이타를 검색하는 중에 에러가 발생했습니다(5).</b></center>";
}
?>
<tr>
<td scope="row" class="no"><?=$no--;?>.</td>
<td class="con"> <a href="/CLRecords/Retrieval2/index.php?hfile=<?=$row[f_file];?>&daesu=<?=$row[f_daesu];?>&mname=<?=$mname;?>&mode=speaker1#w1" onclick="window.open(this.href, 'late', 'scrollbars=yes,width=1024,height=768'); return false;" title="<?=$strTh;?>(새창)"><?=$strTh;?></a></td>
</tr>
<? } ?>
<? } ?>
답변 2
$qry = "select * from tbl_speaker where f_mcode = '".$f_code."' order by f_th desc,f_code asc,f_cha asc limit ".$firstrec.", ".$cnt;
→
$qry = "select * from tbl_speaker where f_mcode = '".$f_code."' order by f_datestr asc, f_th desc,f_code asc,f_cha asc limit ".$firstrec.", ".$cnt;
요일 필드를 추가해서 분리하시는 걸 추천해 드립니다.
답변을 작성하시기 전에 로그인 해주세요.