<?
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 630 | 19년 전 | 2331 | ||
| 629 |
|
19년 전 | 1997 | |
| 628 |
|
19년 전 | 3092 | |
| 627 |
|
19년 전 | 2009 | |
| 626 |
|
19년 전 | 2045 | |
| 625 |
|
19년 전 | 1699 | |
| 624 |
|
19년 전 | 2207 | |
| 623 | 19년 전 | 2184 | ||
| 622 |
|
19년 전 | 2483 | |
| 621 |
|
19년 전 | 2874 | |
| 620 |
|
19년 전 | 2381 | |
| 619 | 19년 전 | 2445 | ||
| 618 | 19년 전 | 3499 | ||
| 617 |
|
19년 전 | 3214 | |
| 616 |
|
19년 전 | 3200 | |
| 615 |
|
19년 전 | 3013 | |
| 614 |
|
19년 전 | 2024 | |
| 613 |
|
19년 전 | 2341 | |
| 612 |
|
19년 전 | 2224 | |
| 611 |
|
19년 전 | 2058 | |
| 610 |
|
19년 전 | 2500 | |
| 609 |
|
19년 전 | 2408 | |
| 608 |
|
19년 전 | 2798 | |
| 607 | 19년 전 | 2174 | ||
| 606 | 19년 전 | 3499 | ||
| 605 | 19년 전 | 1965 | ||
| 604 | 19년 전 | 2569 | ||
| 603 | 19년 전 | 1597 | ||
| 602 |
|
19년 전 | 2827 | |
| 601 | 19년 전 | 3065 | ||
| 600 |
|
19년 전 | 2152 | |
| 599 | 19년 전 | 1988 | ||
| 598 | 19년 전 | 2464 | ||
| 597 | 19년 전 | 2375 | ||
| 596 |
|
19년 전 | 3065 | |
| 595 |
|
19년 전 | 6744 | |
| 594 | 19년 전 | 2702 | ||
| 593 | 19년 전 | 3176 | ||
| 592 |
|
19년 전 | 3074 | |
| 591 |
|
19년 전 | 1917 | |
| 590 | 19년 전 | 3353 | ||
| 589 | 19년 전 | 2182 | ||
| 588 |
|
19년 전 | 2691 | |
| 587 | 19년 전 | 2337 | ||
| 586 |
|
19년 전 | 4350 | |
| 585 | 19년 전 | 2468 | ||
| 584 | 19년 전 | 2735 | ||
| 583 |
|
19년 전 | 3502 | |
| 582 |
|
19년 전 | 3706 | |
| 581 |
|
19년 전 | 3230 | |
| 580 | 19년 전 | 2468 | ||
| 579 | 19년 전 | 3040 | ||
| 578 | 19년 전 | 3901 | ||
| 577 | 19년 전 | 3779 | ||
| 576 | 19년 전 | 1712 | ||
| 575 |
|
19년 전 | 2189 | |
| 574 |
|
19년 전 | 5394 | |
| 573 | 19년 전 | 6694 | ||
| 572 | 19년 전 | 2547 | ||
| 571 | 19년 전 | 2100 | ||
| 570 | 19년 전 | 2593 | ||
| 569 | 19년 전 | 3257 | ||
| 568 | 19년 전 | 3497 | ||
| 567 | 19년 전 | 2974 | ||
| 566 | 19년 전 | 2584 | ||
| 565 |
|
19년 전 | 4693 | |
| 564 |
|
19년 전 | 6699 | |
| 563 |
|
19년 전 | 4970 | |
| 562 |
|
19년 전 | 5931 | |
| 561 |
|
19년 전 | 2669 | |
| 560 |
|
19년 전 | 2487 | |
| 559 |
|
19년 전 | 2198 | |
| 558 |
|
19년 전 | 2284 | |
| 557 | 19년 전 | 4577 | ||
| 556 |
|
19년 전 | 4643 | |
| 555 | 19년 전 | 2487 | ||
| 554 | 19년 전 | 2161 | ||
| 553 | 19년 전 | 2493 | ||
| 552 |
|
19년 전 | 3132 | |
| 551 | 19년 전 | 2921 | ||
| 550 |
|
19년 전 | 1883 | |
| 549 |
|
19년 전 | 1941 | |
| 548 |
|
19년 전 | 3134 | |
| 547 |
|
19년 전 | 2351 | |
| 546 |
|
19년 전 | 3609 | |
| 545 |
|
19년 전 | 2534 | |
| 544 |
|
19년 전 | 1839 | |
| 543 |
|
19년 전 | 2440 | |
| 542 |
|
19년 전 | 1706 | |
| 541 |
|
19년 전 | 1390 | |
| 540 |
|
19년 전 | 1520 | |
| 539 |
|
19년 전 | 1790 | |
| 538 |
|
19년 전 | 1565 | |
| 537 |
|
19년 전 | 1765 | |
| 536 |
|
19년 전 | 1549 | |
| 535 |
|
19년 전 | 1941 | |
| 534 |
|
19년 전 | 1832 | |
| 533 |
|
19년 전 | 1428 | |
| 532 |
|
19년 전 | 1431 | |
| 531 |
|
19년 전 | 1344 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기