PHP 소스를 예전에 쓰던게 있는데 지금은 적용이 되질 않아 확인 부탁드립니다.
내용은
DB에서 테이블을 모두 끌어와 게시판 형태로 페이지로 나누어 보여주는 소스입니다.
이 아래처럼 코딩하면
sql="select * from ".$board." where 1 $opi1 $opi2 $opi3 $mStatus order by test_app_date desc";
$res = sql_query($sql);
while($row = sql_fetch_array($res)){
$test = $row['test_app_date'];
echo''.$test.'';
날짜를 잘 끌어와서 보여줍니다.
그런대 이 아래처럼 코딩하면
출력해주질 않습니다. ㅠㅠ
<? if($status){ $mStatus = " and ( test_app_status = '$status' )"; if($status=="신규"){ $mStatus = " and ( test_app_status = '$status' or test_app_status = NULL )"; } } $board='test_app'; // 신청자 리스트 $page=$page_list; // 보여줄 게시글 수 $pagegroup=10; // 페이지 그룹 수 @$pagenum=$_GET['pagenum']; $start = @$pagenum * $page; // 페이지의 시작 게시 글번호 $sql1="select * from ".$board." where 1 $opi1 $opi2 $opi3 $mStatus order by test_app_date desc"; $result1=sql_query($sql1); $num1=sql_num_rows($result1); $sql2="select * from ".$board." where 1 $opi1 $opi2 $opi3 $mStatus order by test_app_date desc limit $start, $page"; $result2=sql_query($sql2); $pagetotal=ceil($num1 / $page); // 필요한 총 페이지수 $pagegroupnum=ceil(($pagenum+1)/$pagegroup); // 현재 페이지 그룹 $pagestart=($pagegroupnum-1)*$pagegroup+1; // 첫 페이지 그룹 $pageend=$pagestart+$pagegroup-1; // 끝 페이지 그룹 $num=sql_num_rows($result2); $number=$num1-($page*$pagenum);// 글 순서 no표시 if($num<1){ if(!$status) $status = "전체"; echo " <tr> <td colspan='15' style='text-align:center; padding:30px 0; font-size:20px; font-weight:bold;'>[<span style='color:red;'>$status 리스트</span>]에서 검색된 내용이 없습니다.</td> </tr>"; }else{ while($row = sql_fetch_array($result2)) { $write_date = $row['test_app_date']; $write = explode(" ",$write_date); $write_date = $write[0]."<br/><span style='color:#8C8C8C;'>".$write[1]."</span>"; $status = $row['test_app_status']; $title = $row['test_app_title']; $code = $row['test_app_code']; $join = $row['test_app_join']; $petname = $row['test_app_petname']; $model = $row['test_app_model']; $color = $row['test_app_color']; $fee_name = $row['test_app_fee_name']; $name = $row['test_app_name']; $mail = $row['test_app_mail']; $tel = $row['test_app_tel']; $d_tel2 = $row['test_app_d_tel2']; //$telecom = $row['test_app_move_telecom']; $sqlk = "select test_app_code_name from test_app_code where test_app_code_site_code = '$code'"; $resk = sql_query($sqlk); $rowk = sql_fetch_assoc($resk); $code_name = $rowk['test_app_code_name']; // 유입경로 if($row['test_app_file1']){ $file1 = "<a href='../data/file/join/".$row['test_app_file1']."' target='_blank'>[첨부1]</a>"; }else{ $file1=""; } if($row['test_app_file2']){ $file2 = "<a href='../data/file/join/".$row['test_app_file2']."' target='_blank'>[첨부2]</a>"; }else{ $file2=""; } echo " <form name='fo$row[test_app_no]' action='./test_app_exec.php' method='post'> <tr style='font-size:14px;' height='30px'> <td class='test_app_list_td'><input type='checkbox' name='delck' value='$row[test_app_no]'></td> <td class='test_app_list_td'>$number</td> <td class='test_app_list_td'>$write_date</td> <td class='test_app_list_td_manage'>$status</td> <td class='test_app_list_td'>$title</td> <td class='test_app_list_td'>$code_name</td> <td class='test_app_list_td'>$join</td> <td class='test_app_list_td'>$petname</td> <td class='test_app_list_td'>$model</td> <td class='test_app_list_td'>$color</td> <td class='test_app_list_td'><a style='color:blue;text-decoration:none;' href='test_app_view.php?idx=$row[test_app_no]'>$name</a></td> <td class='test_app_list_td'>$mail</td> <td class='test_app_list_td'>$tel</td> <td class='test_app_list_td'>$d_tel2</td> <td class='test_app_list_td'>$file1 $file2</td> <td class='test_app_list_td'> <input type='text' name='test_app_msg' style='width:210px' value='$row[test_app_msg]'> <input type='button' value='확인' onClick=\"javascript:sendMod(document.fo$row[test_app_no],'$row[test_app_no]')\"> </td> <tr> <input type=hidden name='idx' value=''> <input type=hidden name='execMode' value=''> </form>\n"; $number--; } } sql_close($conn); ?>
예상으로는 PHP7 이전에 사용하던 소스라
지금 못쓰나 싶은데 아니면 제가 코딩하면서 빼먹었거나...
근데 도저히 잘못된 부분을 찾을수가 없네요 ㅠㅠ
답변 1개 / 댓글 1개
$sql1, $sql2 를 echo 로 찍어보세요.
sql문이 잘 넘어오는지 확인하는게 우선인 듯 합니다.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
$sqlk = "select test_app_code_name from test_app_code where test_app_code_site_code = '$code'";
$resk = sql_query($sqlk);
$rowk = sql_fetch_assoc($resk);
$code_name = $rowk['test_app_code_name']; // 유입경로
이 문장이 있어서 출력은 안되었는 듯 합니다.
이 문장들을 지우고 나니 데이터는 일정부분 불러와 집니다.
그런데 아직 다른 문제들이 남아있습니다.
혹시 PHP7 에서는
@$pagenum=$_GET['pagenum'];
$start = @$pagenum * $page; // 페이지의 시작 게시 글번호
이 문장이 효과가 없는 것일까요?
글로벌 처리에 대해서 잠시 본듯 한데 자세히는 모르겠군요...
혹시 위와 같은 부분이 PHP7에서 사용이 불가능 하다면,
어떻게 처리하는 것이 좋을까요?