<?
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년 전 | 3543 | ||
| 929 |
|
19년 전 | 2705 | |
| 928 |
|
19년 전 | 3455 | |
| 927 |
|
19년 전 | 3442 | |
| 926 |
|
19년 전 | 3148 | |
| 925 | 19년 전 | 5434 | ||
| 924 |
|
19년 전 | 2168 | |
| 923 |
|
19년 전 | 2221 | |
| 922 |
|
19년 전 | 2315 | |
| 921 |
|
19년 전 | 3409 | |
| 920 | 19년 전 | 3708 | ||
| 919 |
|
19년 전 | 3746 | |
| 918 |
|
19년 전 | 2366 | |
| 917 |
|
19년 전 | 2400 | |
| 916 |
|
19년 전 | 2705 | |
| 915 | 19년 전 | 3048 | ||
| 914 | 19년 전 | 2461 | ||
| 913 | 19년 전 | 2627 | ||
| 912 | 19년 전 | 2461 | ||
| 911 | 19년 전 | 2216 | ||
| 910 | 19년 전 | 3247 | ||
| 909 | 19년 전 | 3303 | ||
| 908 | 19년 전 | 3040 | ||
| 907 |
|
19년 전 | 4875 | |
| 906 |
|
19년 전 | 2715 | |
| 905 |
|
19년 전 | 3318 | |
| 904 |
|
19년 전 | 3149 | |
| 903 |
|
19년 전 | 1997 | |
| 902 |
|
19년 전 | 3143 | |
| 901 |
|
19년 전 | 1878 | |
| 900 |
|
19년 전 | 2337 | |
| 899 |
|
19년 전 | 2404 | |
| 898 |
|
19년 전 | 3985 | |
| 897 |
|
19년 전 | 3187 | |
| 896 |
|
19년 전 | 3103 | |
| 895 |
|
19년 전 | 2540 | |
| 894 |
|
19년 전 | 2017 | |
| 893 |
|
19년 전 | 1649 | |
| 892 |
|
19년 전 | 2416 | |
| 891 |
|
19년 전 | 2330 | |
| 890 |
|
19년 전 | 1815 | |
| 889 |
|
19년 전 | 1811 | |
| 888 |
|
19년 전 | 2612 | |
| 887 |
|
19년 전 | 2581 | |
| 886 |
|
19년 전 | 1875 | |
| 885 |
|
19년 전 | 2114 | |
| 884 |
|
19년 전 | 3306 | |
| 883 |
|
19년 전 | 1952 | |
| 882 |
|
19년 전 | 2502 | |
| 881 |
|
19년 전 | 2582 | |
| 880 |
|
19년 전 | 2664 | |
| 879 |
|
19년 전 | 2939 | |
| 878 |
|
19년 전 | 2559 | |
| 877 |
|
19년 전 | 2984 | |
| 876 |
|
19년 전 | 2762 | |
| 875 |
|
19년 전 | 3523 | |
| 874 | 19년 전 | 1872 | ||
| 873 | 19년 전 | 2736 | ||
| 872 |
|
19년 전 | 2375 | |
| 871 |
|
19년 전 | 2019 | |
| 870 |
|
19년 전 | 2427 | |
| 869 |
|
19년 전 | 1873 | |
| 868 |
|
19년 전 | 5440 | |
| 867 |
|
19년 전 | 2265 | |
| 866 |
|
19년 전 | 4262 | |
| 865 |
|
19년 전 | 2303 | |
| 864 | 19년 전 | 1851 | ||
| 863 | 19년 전 | 2607 | ||
| 862 | 19년 전 | 2334 | ||
| 861 | 19년 전 | 2535 | ||
| 860 | 19년 전 | 2162 | ||
| 859 | 19년 전 | 3927 | ||
| 858 | 19년 전 | 3419 | ||
| 857 | 19년 전 | 2199 | ||
| 856 |
Power
|
19년 전 | 2107 | |
| 855 | 19년 전 | 1972 | ||
| 854 | 19년 전 | 2004 | ||
| 853 |
pearly
|
19년 전 | 4389 | |
| 852 |
pearly
|
19년 전 | 3358 | |
| 851 | 19년 전 | 2775 | ||
| 850 |
pearly
|
19년 전 | 3354 | |
| 849 |
pearly
|
19년 전 | 3013 | |
| 848 |
pearly
|
19년 전 | 2844 | |
| 847 | 19년 전 | 2367 | ||
| 846 |
|
19년 전 | 2174 | |
| 845 |
pearly
|
19년 전 | 2494 | |
| 844 | 19년 전 | 3105 | ||
| 843 | 19년 전 | 2133 | ||
| 842 |
pearly
|
19년 전 | 3124 | |
| 841 |
pearly
|
19년 전 | 3246 | |
| 840 | 19년 전 | 2929 | ||
| 839 |
|
19년 전 | 1941 | |
| 838 |
|
19년 전 | 1707 | |
| 837 |
|
19년 전 | 2330 | |
| 836 |
|
19년 전 | 2272 | |
| 835 |
|
19년 전 | 1648 | |
| 834 |
|
19년 전 | 1666 | |
| 833 |
|
19년 전 | 1574 | |
| 832 |
|
19년 전 | 2068 | |
| 831 |
|
19년 전 | 1616 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기