<?
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년 전 | 3540 | ||
| 929 |
|
19년 전 | 2698 | |
| 928 |
|
19년 전 | 3450 | |
| 927 |
|
19년 전 | 3442 | |
| 926 |
|
19년 전 | 3145 | |
| 925 | 19년 전 | 5429 | ||
| 924 |
|
19년 전 | 2166 | |
| 923 |
|
19년 전 | 2213 | |
| 922 |
|
19년 전 | 2306 | |
| 921 |
|
19년 전 | 3400 | |
| 920 | 19년 전 | 3703 | ||
| 919 |
|
19년 전 | 3743 | |
| 918 |
|
19년 전 | 2350 | |
| 917 |
|
19년 전 | 2388 | |
| 916 |
|
19년 전 | 2690 | |
| 915 | 19년 전 | 3035 | ||
| 914 | 19년 전 | 2457 | ||
| 913 | 19년 전 | 2624 | ||
| 912 | 19년 전 | 2450 | ||
| 911 | 19년 전 | 2208 | ||
| 910 | 19년 전 | 3236 | ||
| 909 | 19년 전 | 3293 | ||
| 908 | 19년 전 | 3028 | ||
| 907 |
|
19년 전 | 4867 | |
| 906 |
|
19년 전 | 2700 | |
| 905 |
|
19년 전 | 3311 | |
| 904 |
|
19년 전 | 3134 | |
| 903 |
|
19년 전 | 1980 | |
| 902 |
|
19년 전 | 3123 | |
| 901 |
|
19년 전 | 1869 | |
| 900 |
|
19년 전 | 2325 | |
| 899 |
|
19년 전 | 2398 | |
| 898 |
|
19년 전 | 3981 | |
| 897 |
|
19년 전 | 3172 | |
| 896 |
|
19년 전 | 3090 | |
| 895 |
|
19년 전 | 2532 | |
| 894 |
|
19년 전 | 2005 | |
| 893 |
|
19년 전 | 1642 | |
| 892 |
|
19년 전 | 2403 | |
| 891 |
|
19년 전 | 2326 | |
| 890 |
|
19년 전 | 1813 | |
| 889 |
|
19년 전 | 1809 | |
| 888 |
|
19년 전 | 2602 | |
| 887 |
|
19년 전 | 2577 | |
| 886 |
|
19년 전 | 1873 | |
| 885 |
|
19년 전 | 2104 | |
| 884 |
|
19년 전 | 3293 | |
| 883 |
|
19년 전 | 1949 | |
| 882 |
|
19년 전 | 2493 | |
| 881 |
|
19년 전 | 2568 | |
| 880 |
|
19년 전 | 2656 | |
| 879 |
|
19년 전 | 2935 | |
| 878 |
|
19년 전 | 2557 | |
| 877 |
|
19년 전 | 2981 | |
| 876 |
|
19년 전 | 2761 | |
| 875 |
|
19년 전 | 3518 | |
| 874 | 19년 전 | 1869 | ||
| 873 | 19년 전 | 2726 | ||
| 872 |
|
19년 전 | 2367 | |
| 871 |
|
19년 전 | 2014 | |
| 870 |
|
19년 전 | 2422 | |
| 869 |
|
19년 전 | 1869 | |
| 868 |
|
19년 전 | 5437 | |
| 867 |
|
19년 전 | 2254 | |
| 866 |
|
19년 전 | 4248 | |
| 865 |
|
19년 전 | 2289 | |
| 864 | 19년 전 | 1839 | ||
| 863 | 19년 전 | 2593 | ||
| 862 | 19년 전 | 2326 | ||
| 861 | 19년 전 | 2525 | ||
| 860 | 19년 전 | 2157 | ||
| 859 | 19년 전 | 3918 | ||
| 858 | 19년 전 | 3414 | ||
| 857 | 19년 전 | 2196 | ||
| 856 |
Power
|
19년 전 | 2106 | |
| 855 | 19년 전 | 1970 | ||
| 854 | 19년 전 | 1997 | ||
| 853 |
pearly
|
19년 전 | 4380 | |
| 852 |
pearly
|
19년 전 | 3352 | |
| 851 | 19년 전 | 2773 | ||
| 850 |
pearly
|
19년 전 | 3345 | |
| 849 |
pearly
|
19년 전 | 3003 | |
| 848 |
pearly
|
19년 전 | 2839 | |
| 847 | 19년 전 | 2346 | ||
| 846 |
|
19년 전 | 2160 | |
| 845 |
pearly
|
19년 전 | 2483 | |
| 844 | 19년 전 | 3094 | ||
| 843 | 19년 전 | 2125 | ||
| 842 |
pearly
|
19년 전 | 3117 | |
| 841 |
pearly
|
19년 전 | 3240 | |
| 840 | 19년 전 | 2917 | ||
| 839 |
|
19년 전 | 1933 | |
| 838 |
|
19년 전 | 1699 | |
| 837 |
|
19년 전 | 2314 | |
| 836 |
|
19년 전 | 2254 | |
| 835 |
|
19년 전 | 1634 | |
| 834 |
|
19년 전 | 1659 | |
| 833 |
|
19년 전 | 1563 | |
| 832 |
|
19년 전 | 2064 | |
| 831 |
|
19년 전 | 1616 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기