<?
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년 전 | 2349 | ||
| 629 |
|
19년 전 | 2011 | |
| 628 |
|
19년 전 | 3126 | |
| 627 |
|
19년 전 | 2033 | |
| 626 |
|
19년 전 | 2066 | |
| 625 |
|
19년 전 | 1719 | |
| 624 |
|
19년 전 | 2223 | |
| 623 | 19년 전 | 2198 | ||
| 622 |
|
19년 전 | 2508 | |
| 621 |
|
19년 전 | 2910 | |
| 620 |
|
19년 전 | 2404 | |
| 619 | 19년 전 | 2472 | ||
| 618 | 19년 전 | 3515 | ||
| 617 |
|
19년 전 | 3232 | |
| 616 |
|
19년 전 | 3222 | |
| 615 |
|
19년 전 | 3038 | |
| 614 |
|
19년 전 | 2045 | |
| 613 |
|
19년 전 | 2378 | |
| 612 |
|
19년 전 | 2239 | |
| 611 |
|
19년 전 | 2085 | |
| 610 |
|
19년 전 | 2520 | |
| 609 |
|
19년 전 | 2421 | |
| 608 |
|
19년 전 | 2812 | |
| 607 | 19년 전 | 2194 | ||
| 606 | 19년 전 | 3531 | ||
| 605 | 19년 전 | 1989 | ||
| 604 | 19년 전 | 2600 | ||
| 603 | 19년 전 | 1612 | ||
| 602 |
|
19년 전 | 2836 | |
| 601 | 19년 전 | 3074 | ||
| 600 |
|
19년 전 | 2153 | |
| 599 | 19년 전 | 2002 | ||
| 598 | 19년 전 | 2481 | ||
| 597 | 19년 전 | 2389 | ||
| 596 |
|
19년 전 | 3074 | |
| 595 |
|
19년 전 | 6753 | |
| 594 | 19년 전 | 2709 | ||
| 593 | 19년 전 | 3186 | ||
| 592 |
|
19년 전 | 3089 | |
| 591 |
|
19년 전 | 1931 | |
| 590 | 19년 전 | 3364 | ||
| 589 | 19년 전 | 2209 | ||
| 588 |
|
19년 전 | 2707 | |
| 587 | 19년 전 | 2345 | ||
| 586 |
|
19년 전 | 4364 | |
| 585 | 19년 전 | 2487 | ||
| 584 | 19년 전 | 2758 | ||
| 583 |
|
19년 전 | 3522 | |
| 582 |
|
19년 전 | 3718 | |
| 581 |
|
19년 전 | 3256 | |
| 580 | 19년 전 | 2485 | ||
| 579 | 19년 전 | 3074 | ||
| 578 | 19년 전 | 3974 | ||
| 577 | 19년 전 | 3814 | ||
| 576 | 19년 전 | 1751 | ||
| 575 |
|
19년 전 | 2208 | |
| 574 |
|
19년 전 | 5403 | |
| 573 | 19년 전 | 6717 | ||
| 572 | 19년 전 | 2565 | ||
| 571 | 19년 전 | 2106 | ||
| 570 | 19년 전 | 2601 | ||
| 569 | 19년 전 | 3301 | ||
| 568 | 19년 전 | 3528 | ||
| 567 | 19년 전 | 2981 | ||
| 566 | 19년 전 | 2602 | ||
| 565 |
|
19년 전 | 4719 | |
| 564 |
|
19년 전 | 6728 | |
| 563 |
|
19년 전 | 5008 | |
| 562 |
|
19년 전 | 5950 | |
| 561 |
|
19년 전 | 2692 | |
| 560 |
|
19년 전 | 2539 | |
| 559 |
|
19년 전 | 2222 | |
| 558 |
|
19년 전 | 2302 | |
| 557 | 19년 전 | 4595 | ||
| 556 |
|
19년 전 | 4668 | |
| 555 | 19년 전 | 2507 | ||
| 554 | 19년 전 | 2175 | ||
| 553 | 19년 전 | 2525 | ||
| 552 |
|
19년 전 | 3166 | |
| 551 | 19년 전 | 2938 | ||
| 550 |
|
19년 전 | 1898 | |
| 549 |
|
19년 전 | 1957 | |
| 548 |
|
19년 전 | 3146 | |
| 547 |
|
19년 전 | 2357 | |
| 546 |
|
19년 전 | 3617 | |
| 545 |
|
19년 전 | 2547 | |
| 544 |
|
19년 전 | 1850 | |
| 543 |
|
19년 전 | 2454 | |
| 542 |
|
19년 전 | 1729 | |
| 541 |
|
19년 전 | 1408 | |
| 540 |
|
19년 전 | 1536 | |
| 539 |
|
19년 전 | 1804 | |
| 538 |
|
19년 전 | 1584 | |
| 537 |
|
19년 전 | 1780 | |
| 536 |
|
19년 전 | 1561 | |
| 535 |
|
19년 전 | 1960 | |
| 534 |
|
19년 전 | 1845 | |
| 533 |
|
19년 전 | 1448 | |
| 532 |
|
19년 전 | 1442 | |
| 531 |
|
19년 전 | 1357 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기