<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1030 | 18년 전 | 1788 | ||
| 1029 | 18년 전 | 2218 | ||
| 1028 | 18년 전 | 2630 | ||
| 1027 | 18년 전 | 1791 | ||
| 1026 | 18년 전 | 1524 | ||
| 1025 | 18년 전 | 1539 | ||
| 1024 | 18년 전 | 1463 | ||
| 1023 | 18년 전 | 3225 | ||
| 1022 | 18년 전 | 2915 | ||
| 1021 | 18년 전 | 1675 | ||
| 1020 | 18년 전 | 3409 | ||
| 1019 | 18년 전 | 1838 | ||
| 1018 | 18년 전 | 1491 | ||
| 1017 | 18년 전 | 1958 | ||
| 1016 | 18년 전 | 2097 | ||
| 1015 | 18년 전 | 1631 | ||
| 1014 | 18년 전 | 2343 | ||
| 1013 | 18년 전 | 1999 | ||
| 1012 | 18년 전 | 1622 | ||
| 1011 | 18년 전 | 1784 | ||
| 1010 | 18년 전 | 2039 | ||
| 1009 | 18년 전 | 1799 | ||
| 1008 | 18년 전 | 1608 | ||
| 1007 | 18년 전 | 1662 | ||
| 1006 | 18년 전 | 3132 | ||
| 1005 | 18년 전 | 1992 | ||
| 1004 | 18년 전 | 1867 | ||
| 1003 | 18년 전 | 4367 | ||
| 1002 | 18년 전 | 4993 | ||
| 1001 | 18년 전 | 3160 | ||
| 1000 | 18년 전 | 2908 | ||
| 999 | 18년 전 | 3497 | ||
| 998 | 18년 전 | 2045 | ||
| 997 | 18년 전 | 2403 | ||
| 996 | 18년 전 | 2696 | ||
| 995 | 18년 전 | 2751 | ||
| 994 | 18년 전 | 2347 | ||
| 993 | 18년 전 | 1613 | ||
| 992 | 18년 전 | 3376 | ||
| 991 | 18년 전 | 1983 | ||
| 990 | 18년 전 | 2379 | ||
| 989 | 18년 전 | 2454 | ||
| 988 | 18년 전 | 2881 | ||
| 987 | 18년 전 | 5214 | ||
| 986 |
|
18년 전 | 2489 | |
| 985 |
|
18년 전 | 3341 | |
| 984 | 18년 전 | 4275 | ||
| 983 |
느낌좋은날
|
19년 전 | 2500 | |
| 982 | 19년 전 | 2464 | ||
| 981 | 19년 전 | 4040 | ||
| 980 | 19년 전 | 2747 | ||
| 979 |
Sinpre
|
19년 전 | 2989 | |
| 978 | 19년 전 | 2207 | ||
| 977 | 19년 전 | 2218 | ||
| 976 | 19년 전 | 1990 | ||
| 975 | 19년 전 | 3273 | ||
| 974 | 19년 전 | 2106 | ||
| 973 |
|
19년 전 | 2782 | |
| 972 |
|
19년 전 | 1743 | |
| 971 | 19년 전 | 5314 | ||
| 970 | 19년 전 | 3571 | ||
| 969 | 19년 전 | 4322 | ||
| 968 | 19년 전 | 3065 | ||
| 967 | 19년 전 | 2523 | ||
| 966 | 19년 전 | 3920 | ||
| 965 | 19년 전 | 2648 | ||
| 964 | 19년 전 | 2991 | ||
| 963 | 19년 전 | 2959 | ||
| 962 | 19년 전 | 4175 | ||
| 961 | 19년 전 | 3127 | ||
| 960 | 19년 전 | 3021 | ||
| 959 | 19년 전 | 3671 | ||
| 958 | 19년 전 | 2974 | ||
| 957 | 19년 전 | 2190 | ||
| 956 | 19년 전 | 2223 | ||
| 955 | 19년 전 | 2174 | ||
| 954 | 19년 전 | 2766 | ||
| 953 | 19년 전 | 2476 | ||
| 952 | 19년 전 | 3344 | ||
| 951 | 19년 전 | 3202 | ||
| 950 | 19년 전 | 1826 | ||
| 949 | 19년 전 | 2740 | ||
| 948 | 19년 전 | 7824 | ||
| 947 |
|
19년 전 | 2501 | |
| 946 |
DeepnBlue
|
19년 전 | 3103 | |
| 945 |
pearly
|
19년 전 | 2870 | |
| 944 | 19년 전 | 3023 | ||
| 943 |
|
19년 전 | 2224 | |
| 942 | 19년 전 | 2452 | ||
| 941 |
|
19년 전 | 4072 | |
| 940 | 19년 전 | 2232 | ||
| 939 |
|
19년 전 | 4220 | |
| 938 |
|
19년 전 | 2382 | |
| 937 | 19년 전 | 2073 | ||
| 936 |
|
19년 전 | 2328 | |
| 935 | 19년 전 | 1872 | ||
| 934 |
|
19년 전 | 2407 | |
| 933 | 19년 전 | 2198 | ||
| 932 |
|
19년 전 | 3066 | |
| 931 | 19년 전 | 1854 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기