<?
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년 전 | 1789 | ||
| 1029 | 18년 전 | 2222 | ||
| 1028 | 18년 전 | 2632 | ||
| 1027 | 18년 전 | 1794 | ||
| 1026 | 18년 전 | 1532 | ||
| 1025 | 18년 전 | 1544 | ||
| 1024 | 18년 전 | 1467 | ||
| 1023 | 18년 전 | 3229 | ||
| 1022 | 18년 전 | 2917 | ||
| 1021 | 18년 전 | 1677 | ||
| 1020 | 18년 전 | 3419 | ||
| 1019 | 18년 전 | 1844 | ||
| 1018 | 18년 전 | 1495 | ||
| 1017 | 18년 전 | 1962 | ||
| 1016 | 18년 전 | 2102 | ||
| 1015 | 18년 전 | 1636 | ||
| 1014 | 18년 전 | 2347 | ||
| 1013 | 18년 전 | 2005 | ||
| 1012 | 18년 전 | 1627 | ||
| 1011 | 18년 전 | 1786 | ||
| 1010 | 18년 전 | 2041 | ||
| 1009 | 18년 전 | 1806 | ||
| 1008 | 18년 전 | 1621 | ||
| 1007 | 18년 전 | 1666 | ||
| 1006 | 18년 전 | 3135 | ||
| 1005 | 18년 전 | 2001 | ||
| 1004 | 18년 전 | 1876 | ||
| 1003 | 18년 전 | 4370 | ||
| 1002 | 18년 전 | 4997 | ||
| 1001 | 18년 전 | 3166 | ||
| 1000 | 18년 전 | 2911 | ||
| 999 | 18년 전 | 3504 | ||
| 998 | 18년 전 | 2049 | ||
| 997 | 18년 전 | 2411 | ||
| 996 | 18년 전 | 2705 | ||
| 995 | 18년 전 | 2761 | ||
| 994 | 18년 전 | 2350 | ||
| 993 | 18년 전 | 1618 | ||
| 992 | 18년 전 | 3381 | ||
| 991 | 18년 전 | 1992 | ||
| 990 | 18년 전 | 2390 | ||
| 989 | 18년 전 | 2461 | ||
| 988 | 19년 전 | 2891 | ||
| 987 | 19년 전 | 5223 | ||
| 986 |
|
19년 전 | 2496 | |
| 985 |
|
19년 전 | 3348 | |
| 984 | 19년 전 | 4280 | ||
| 983 |
느낌좋은날
|
19년 전 | 2504 | |
| 982 | 19년 전 | 2470 | ||
| 981 | 19년 전 | 4042 | ||
| 980 | 19년 전 | 2749 | ||
| 979 |
Sinpre
|
19년 전 | 2990 | |
| 978 | 19년 전 | 2208 | ||
| 977 | 19년 전 | 2223 | ||
| 976 | 19년 전 | 1992 | ||
| 975 | 19년 전 | 3275 | ||
| 974 | 19년 전 | 2109 | ||
| 973 |
|
19년 전 | 2793 | |
| 972 |
|
19년 전 | 1749 | |
| 971 | 19년 전 | 5322 | ||
| 970 | 19년 전 | 3576 | ||
| 969 | 19년 전 | 4327 | ||
| 968 | 19년 전 | 3070 | ||
| 967 | 19년 전 | 2528 | ||
| 966 | 19년 전 | 3930 | ||
| 965 | 19년 전 | 2659 | ||
| 964 | 19년 전 | 2999 | ||
| 963 | 19년 전 | 2972 | ||
| 962 | 19년 전 | 4184 | ||
| 961 | 19년 전 | 3129 | ||
| 960 | 19년 전 | 3023 | ||
| 959 | 19년 전 | 3676 | ||
| 958 | 19년 전 | 2978 | ||
| 957 | 19년 전 | 2192 | ||
| 956 | 19년 전 | 2225 | ||
| 955 | 19년 전 | 2177 | ||
| 954 | 19년 전 | 2771 | ||
| 953 | 19년 전 | 2480 | ||
| 952 | 19년 전 | 3349 | ||
| 951 | 19년 전 | 3206 | ||
| 950 | 19년 전 | 1827 | ||
| 949 | 19년 전 | 2740 | ||
| 948 | 19년 전 | 7829 | ||
| 947 |
|
19년 전 | 2504 | |
| 946 |
DeepnBlue
|
19년 전 | 3108 | |
| 945 |
pearly
|
19년 전 | 2884 | |
| 944 | 19년 전 | 3028 | ||
| 943 |
|
19년 전 | 2232 | |
| 942 | 19년 전 | 2455 | ||
| 941 |
|
19년 전 | 4079 | |
| 940 | 19년 전 | 2235 | ||
| 939 |
|
19년 전 | 4220 | |
| 938 |
|
19년 전 | 2385 | |
| 937 | 19년 전 | 2085 | ||
| 936 |
|
19년 전 | 2330 | |
| 935 | 19년 전 | 1880 | ||
| 934 |
|
19년 전 | 2412 | |
| 933 | 19년 전 | 2205 | ||
| 932 |
|
19년 전 | 3075 | |
| 931 | 19년 전 | 1863 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기