<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 930 | 19년 전 | 3550 | ||
| 929 |
|
19년 전 | 2710 | |
| 928 |
|
19년 전 | 3458 | |
| 927 |
|
19년 전 | 3445 | |
| 926 |
|
19년 전 | 3150 | |
| 925 | 19년 전 | 5435 | ||
| 924 |
|
19년 전 | 2170 | |
| 923 |
|
19년 전 | 2227 | |
| 922 |
|
19년 전 | 2317 | |
| 921 |
|
19년 전 | 3413 | |
| 920 | 19년 전 | 3713 | ||
| 919 |
|
19년 전 | 3749 | |
| 918 |
|
19년 전 | 2370 | |
| 917 |
|
19년 전 | 2401 | |
| 916 |
|
19년 전 | 2709 | |
| 915 | 19년 전 | 3053 | ||
| 914 | 19년 전 | 2467 | ||
| 913 | 19년 전 | 2629 | ||
| 912 | 19년 전 | 2463 | ||
| 911 | 19년 전 | 2220 | ||
| 910 | 19년 전 | 3252 | ||
| 909 | 19년 전 | 3312 | ||
| 908 | 19년 전 | 3044 | ||
| 907 |
|
19년 전 | 4877 | |
| 906 |
|
19년 전 | 2719 | |
| 905 |
|
19년 전 | 3321 | |
| 904 |
|
19년 전 | 3157 | |
| 903 |
|
19년 전 | 1998 | |
| 902 |
|
19년 전 | 3152 | |
| 901 |
|
19년 전 | 1884 | |
| 900 |
|
19년 전 | 2347 | |
| 899 |
|
19년 전 | 2405 | |
| 898 |
|
19년 전 | 3988 | |
| 897 |
|
19년 전 | 3191 | |
| 896 |
|
19년 전 | 3108 | |
| 895 |
|
19년 전 | 2544 | |
| 894 |
|
19년 전 | 2021 | |
| 893 |
|
19년 전 | 1655 | |
| 892 |
|
19년 전 | 2420 | |
| 891 |
|
19년 전 | 2332 | |
| 890 |
|
19년 전 | 1817 | |
| 889 |
|
19년 전 | 1817 | |
| 888 |
|
19년 전 | 2614 | |
| 887 |
|
19년 전 | 2586 | |
| 886 |
|
19년 전 | 1877 | |
| 885 |
|
19년 전 | 2124 | |
| 884 |
|
19년 전 | 3311 | |
| 883 |
|
19년 전 | 1959 | |
| 882 |
|
19년 전 | 2507 | |
| 881 |
|
19년 전 | 2586 | |
| 880 |
|
19년 전 | 2666 | |
| 879 |
|
19년 전 | 2941 | |
| 878 |
|
19년 전 | 2563 | |
| 877 |
|
19년 전 | 2985 | |
| 876 |
|
19년 전 | 2764 | |
| 875 |
|
19년 전 | 3525 | |
| 874 | 19년 전 | 1874 | ||
| 873 | 19년 전 | 2739 | ||
| 872 |
|
19년 전 | 2377 | |
| 871 |
|
19년 전 | 2021 | |
| 870 |
|
19년 전 | 2429 | |
| 869 |
|
19년 전 | 1875 | |
| 868 |
|
19년 전 | 5445 | |
| 867 |
|
19년 전 | 2271 | |
| 866 |
|
19년 전 | 4271 | |
| 865 |
|
19년 전 | 2305 | |
| 864 | 19년 전 | 1857 | ||
| 863 | 19년 전 | 2614 | ||
| 862 | 19년 전 | 2336 | ||
| 861 | 19년 전 | 2536 | ||
| 860 | 19년 전 | 2166 | ||
| 859 | 19년 전 | 3929 | ||
| 858 | 19년 전 | 3425 | ||
| 857 | 19년 전 | 2205 | ||
| 856 |
Power
|
19년 전 | 2109 | |
| 855 | 19년 전 | 1972 | ||
| 854 | 19년 전 | 2007 | ||
| 853 |
pearly
|
19년 전 | 4393 | |
| 852 |
pearly
|
19년 전 | 3359 | |
| 851 | 19년 전 | 2783 | ||
| 850 |
pearly
|
19년 전 | 3355 | |
| 849 |
pearly
|
19년 전 | 3016 | |
| 848 |
pearly
|
19년 전 | 2849 | |
| 847 | 19년 전 | 2370 | ||
| 846 |
|
19년 전 | 2179 | |
| 845 |
pearly
|
19년 전 | 2501 | |
| 844 | 19년 전 | 3110 | ||
| 843 | 19년 전 | 2137 | ||
| 842 |
pearly
|
19년 전 | 3126 | |
| 841 |
pearly
|
19년 전 | 3254 | |
| 840 | 19년 전 | 2931 | ||
| 839 |
|
19년 전 | 1947 | |
| 838 |
|
19년 전 | 1708 | |
| 837 |
|
19년 전 | 2333 | |
| 836 |
|
19년 전 | 2275 | |
| 835 |
|
19년 전 | 1651 | |
| 834 |
|
19년 전 | 1668 | |
| 833 |
|
19년 전 | 1577 | |
| 832 |
|
19년 전 | 2070 | |
| 831 |
|
19년 전 | 1617 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기