<?
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년 전 | 1772 | ||
| 1029 | 18년 전 | 2203 | ||
| 1028 | 18년 전 | 2619 | ||
| 1027 | 18년 전 | 1779 | ||
| 1026 | 18년 전 | 1511 | ||
| 1025 | 18년 전 | 1527 | ||
| 1024 | 18년 전 | 1455 | ||
| 1023 | 18년 전 | 3216 | ||
| 1022 | 18년 전 | 2907 | ||
| 1021 | 18년 전 | 1663 | ||
| 1020 | 18년 전 | 3402 | ||
| 1019 | 18년 전 | 1830 | ||
| 1018 | 18년 전 | 1480 | ||
| 1017 | 18년 전 | 1940 | ||
| 1016 | 18년 전 | 2088 | ||
| 1015 | 18년 전 | 1619 | ||
| 1014 | 18년 전 | 2329 | ||
| 1013 | 18년 전 | 1990 | ||
| 1012 | 18년 전 | 1598 | ||
| 1011 | 18년 전 | 1776 | ||
| 1010 | 18년 전 | 2026 | ||
| 1009 | 18년 전 | 1785 | ||
| 1008 | 18년 전 | 1588 | ||
| 1007 | 18년 전 | 1649 | ||
| 1006 | 18년 전 | 3120 | ||
| 1005 | 18년 전 | 1983 | ||
| 1004 | 18년 전 | 1856 | ||
| 1003 | 18년 전 | 4361 | ||
| 1002 | 18년 전 | 4985 | ||
| 1001 | 18년 전 | 3153 | ||
| 1000 | 18년 전 | 2898 | ||
| 999 | 18년 전 | 3487 | ||
| 998 | 18년 전 | 2034 | ||
| 997 | 18년 전 | 2381 | ||
| 996 | 18년 전 | 2679 | ||
| 995 | 18년 전 | 2750 | ||
| 994 | 18년 전 | 2341 | ||
| 993 | 18년 전 | 1603 | ||
| 992 | 18년 전 | 3369 | ||
| 991 | 18년 전 | 1967 | ||
| 990 | 18년 전 | 2376 | ||
| 989 | 18년 전 | 2441 | ||
| 988 | 18년 전 | 2873 | ||
| 987 | 18년 전 | 5201 | ||
| 986 |
|
18년 전 | 2479 | |
| 985 |
|
18년 전 | 3319 | |
| 984 | 18년 전 | 4268 | ||
| 983 |
느낌좋은날
|
18년 전 | 2492 | |
| 982 | 18년 전 | 2454 | ||
| 981 | 18년 전 | 4028 | ||
| 980 | 18년 전 | 2741 | ||
| 979 |
Sinpre
|
19년 전 | 2982 | |
| 978 | 19년 전 | 2192 | ||
| 977 | 19년 전 | 2211 | ||
| 976 | 19년 전 | 1989 | ||
| 975 | 19년 전 | 3269 | ||
| 974 | 19년 전 | 2102 | ||
| 973 |
|
19년 전 | 2776 | |
| 972 |
|
19년 전 | 1735 | |
| 971 | 19년 전 | 5306 | ||
| 970 | 19년 전 | 3556 | ||
| 969 | 19년 전 | 4307 | ||
| 968 | 19년 전 | 3052 | ||
| 967 | 19년 전 | 2519 | ||
| 966 | 19년 전 | 3915 | ||
| 965 | 19년 전 | 2636 | ||
| 964 | 19년 전 | 2982 | ||
| 963 | 19년 전 | 2949 | ||
| 962 | 19년 전 | 4171 | ||
| 961 | 19년 전 | 3119 | ||
| 960 | 19년 전 | 3012 | ||
| 959 | 19년 전 | 3664 | ||
| 958 | 19년 전 | 2965 | ||
| 957 | 19년 전 | 2188 | ||
| 956 | 19년 전 | 2214 | ||
| 955 | 19년 전 | 2152 | ||
| 954 | 19년 전 | 2761 | ||
| 953 | 19년 전 | 2467 | ||
| 952 | 19년 전 | 3333 | ||
| 951 | 19년 전 | 3185 | ||
| 950 | 19년 전 | 1815 | ||
| 949 | 19년 전 | 2733 | ||
| 948 | 19년 전 | 7817 | ||
| 947 |
|
19년 전 | 2489 | |
| 946 |
DeepnBlue
|
19년 전 | 3095 | |
| 945 |
pearly
|
19년 전 | 2847 | |
| 944 | 19년 전 | 3007 | ||
| 943 |
|
19년 전 | 2208 | |
| 942 | 19년 전 | 2446 | ||
| 941 |
|
19년 전 | 4066 | |
| 940 | 19년 전 | 2225 | ||
| 939 |
|
19년 전 | 4214 | |
| 938 |
|
19년 전 | 2374 | |
| 937 | 19년 전 | 2069 | ||
| 936 |
|
19년 전 | 2320 | |
| 935 | 19년 전 | 1860 | ||
| 934 |
|
19년 전 | 2393 | |
| 933 | 19년 전 | 2185 | ||
| 932 |
|
19년 전 | 3057 | |
| 931 | 19년 전 | 1842 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기