<?
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년 전 | 3539 | ||
| 929 |
|
19년 전 | 2693 | |
| 928 |
|
19년 전 | 3446 | |
| 927 |
|
19년 전 | 3442 | |
| 926 |
|
19년 전 | 3145 | |
| 925 | 19년 전 | 5429 | ||
| 924 |
|
19년 전 | 2166 | |
| 923 |
|
19년 전 | 2212 | |
| 922 |
|
19년 전 | 2304 | |
| 921 |
|
19년 전 | 3392 | |
| 920 | 19년 전 | 3701 | ||
| 919 |
|
19년 전 | 3739 | |
| 918 |
|
19년 전 | 2344 | |
| 917 |
|
19년 전 | 2386 | |
| 916 |
|
19년 전 | 2684 | |
| 915 | 19년 전 | 3033 | ||
| 914 | 19년 전 | 2457 | ||
| 913 | 19년 전 | 2622 | ||
| 912 | 19년 전 | 2448 | ||
| 911 | 19년 전 | 2203 | ||
| 910 | 19년 전 | 3231 | ||
| 909 | 19년 전 | 3289 | ||
| 908 | 19년 전 | 3025 | ||
| 907 |
|
19년 전 | 4865 | |
| 906 |
|
19년 전 | 2694 | |
| 905 |
|
19년 전 | 3306 | |
| 904 |
|
19년 전 | 3132 | |
| 903 |
|
19년 전 | 1979 | |
| 902 |
|
19년 전 | 3118 | |
| 901 |
|
19년 전 | 1865 | |
| 900 |
|
19년 전 | 2325 | |
| 899 |
|
19년 전 | 2396 | |
| 898 |
|
19년 전 | 3978 | |
| 897 |
|
19년 전 | 3167 | |
| 896 |
|
19년 전 | 3088 | |
| 895 |
|
19년 전 | 2532 | |
| 894 |
|
19년 전 | 2000 | |
| 893 |
|
19년 전 | 1637 | |
| 892 |
|
19년 전 | 2401 | |
| 891 |
|
19년 전 | 2326 | |
| 890 |
|
19년 전 | 1812 | |
| 889 |
|
19년 전 | 1809 | |
| 888 |
|
19년 전 | 2599 | |
| 887 |
|
19년 전 | 2576 | |
| 886 |
|
19년 전 | 1871 | |
| 885 |
|
19년 전 | 2104 | |
| 884 |
|
19년 전 | 3290 | |
| 883 |
|
19년 전 | 1949 | |
| 882 |
|
19년 전 | 2488 | |
| 881 |
|
19년 전 | 2567 | |
| 880 |
|
19년 전 | 2656 | |
| 879 |
|
19년 전 | 2934 | |
| 878 |
|
19년 전 | 2556 | |
| 877 |
|
19년 전 | 2979 | |
| 876 |
|
19년 전 | 2761 | |
| 875 |
|
19년 전 | 3517 | |
| 874 | 19년 전 | 1867 | ||
| 873 | 19년 전 | 2726 | ||
| 872 |
|
19년 전 | 2365 | |
| 871 |
|
19년 전 | 2013 | |
| 870 |
|
19년 전 | 2421 | |
| 869 |
|
19년 전 | 1867 | |
| 868 |
|
19년 전 | 5436 | |
| 867 |
|
19년 전 | 2253 | |
| 866 |
|
19년 전 | 4239 | |
| 865 |
|
19년 전 | 2289 | |
| 864 | 19년 전 | 1839 | ||
| 863 | 19년 전 | 2587 | ||
| 862 | 19년 전 | 2325 | ||
| 861 | 19년 전 | 2523 | ||
| 860 | 19년 전 | 2156 | ||
| 859 | 19년 전 | 3916 | ||
| 858 | 19년 전 | 3414 | ||
| 857 | 19년 전 | 2195 | ||
| 856 |
Power
|
19년 전 | 2104 | |
| 855 | 19년 전 | 1970 | ||
| 854 | 19년 전 | 1997 | ||
| 853 |
pearly
|
19년 전 | 4373 | |
| 852 |
pearly
|
19년 전 | 3351 | |
| 851 | 19년 전 | 2773 | ||
| 850 |
pearly
|
19년 전 | 3344 | |
| 849 |
pearly
|
19년 전 | 3000 | |
| 848 |
pearly
|
19년 전 | 2839 | |
| 847 | 19년 전 | 2344 | ||
| 846 |
|
19년 전 | 2157 | |
| 845 |
pearly
|
19년 전 | 2482 | |
| 844 | 19년 전 | 3094 | ||
| 843 | 19년 전 | 2122 | ||
| 842 |
pearly
|
19년 전 | 3117 | |
| 841 |
pearly
|
19년 전 | 3240 | |
| 840 | 19년 전 | 2912 | ||
| 839 |
|
19년 전 | 1931 | |
| 838 |
|
19년 전 | 1696 | |
| 837 |
|
19년 전 | 2312 | |
| 836 |
|
19년 전 | 2251 | |
| 835 |
|
19년 전 | 1622 | |
| 834 |
|
19년 전 | 1657 | |
| 833 |
|
19년 전 | 1560 | |
| 832 |
|
19년 전 | 2064 | |
| 831 |
|
19년 전 | 1614 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기