<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 397 | ||
| 7929 | 9년 전 | 314 | ||
| 7928 | 9년 전 | 406 | ||
| 7927 | 9년 전 | 326 | ||
| 7926 | 9년 전 | 657 | ||
| 7925 | 9년 전 | 340 | ||
| 7924 | 9년 전 | 328 | ||
| 7923 | 9년 전 | 333 | ||
| 7922 | 9년 전 | 368 | ||
| 7921 | 9년 전 | 394 | ||
| 7920 | 9년 전 | 312 | ||
| 7919 | 9년 전 | 330 | ||
| 7918 | 9년 전 | 485 | ||
| 7917 | 9년 전 | 323 | ||
| 7916 | 9년 전 | 398 | ||
| 7915 | 9년 전 | 396 | ||
| 7914 | 9년 전 | 403 | ||
| 7913 | 9년 전 | 559 | ||
| 7912 | 9년 전 | 407 | ||
| 7911 | 9년 전 | 355 | ||
| 7910 | 9년 전 | 398 | ||
| 7909 | 9년 전 | 498 | ||
| 7908 | 9년 전 | 411 | ||
| 7907 | 9년 전 | 356 | ||
| 7906 | 9년 전 | 377 | ||
| 7905 | 9년 전 | 354 | ||
| 7904 | 9년 전 | 341 | ||
| 7903 | 9년 전 | 341 | ||
| 7902 | 9년 전 | 547 | ||
| 7901 |
|
9년 전 | 726 | |
| 7900 | 9년 전 | 568 | ||
| 7899 | 9년 전 | 366 | ||
| 7898 | 9년 전 | 377 | ||
| 7897 | 9년 전 | 330 | ||
| 7896 | 9년 전 | 350 | ||
| 7895 | 9년 전 | 459 | ||
| 7894 | 9년 전 | 375 | ||
| 7893 | 9년 전 | 323 | ||
| 7892 | 9년 전 | 372 | ||
| 7891 | 9년 전 | 751 | ||
| 7890 | 9년 전 | 1187 | ||
| 7889 | 9년 전 | 741 | ||
| 7888 |
limsy1987
|
9년 전 | 540 | |
| 7887 | 9년 전 | 534 | ||
| 7886 | 9년 전 | 422 | ||
| 7885 | 9년 전 | 394 | ||
| 7884 | 9년 전 | 398 | ||
| 7883 | 9년 전 | 393 | ||
| 7882 | 9년 전 | 435 | ||
| 7881 | 9년 전 | 427 | ||
| 7880 | 9년 전 | 547 | ||
| 7879 | 9년 전 | 448 | ||
| 7878 | 9년 전 | 1205 | ||
| 7877 | 9년 전 | 738 | ||
| 7876 | 9년 전 | 470 | ||
| 7875 | 9년 전 | 548 | ||
| 7874 |
|
9년 전 | 797 | |
| 7873 | 9년 전 | 509 | ||
| 7872 | 9년 전 | 662 | ||
| 7871 | 9년 전 | 471 | ||
| 7870 | 9년 전 | 597 | ||
| 7869 | 9년 전 | 420 | ||
| 7868 | 9년 전 | 429 | ||
| 7867 | 9년 전 | 408 | ||
| 7866 | 9년 전 | 476 | ||
| 7865 | 9년 전 | 440 | ||
| 7864 | 9년 전 | 503 | ||
| 7863 | 9년 전 | 498 | ||
| 7862 | 9년 전 | 459 | ||
| 7861 | 9년 전 | 617 | ||
| 7860 | 9년 전 | 608 | ||
| 7859 | 9년 전 | 398 | ||
| 7858 | 9년 전 | 693 | ||
| 7857 | 9년 전 | 1060 | ||
| 7856 | 9년 전 | 507 | ||
| 7855 | 9년 전 | 732 | ||
| 7854 | 9년 전 | 721 | ||
| 7853 | 9년 전 | 570 | ||
| 7852 | 9년 전 | 499 | ||
| 7851 | 9년 전 | 491 | ||
| 7850 | 9년 전 | 576 | ||
| 7849 | 9년 전 | 351 | ||
| 7848 | 9년 전 | 402 | ||
| 7847 | 9년 전 | 639 | ||
| 7846 | 9년 전 | 445 | ||
| 7845 | 9년 전 | 404 | ||
| 7844 | 9년 전 | 385 | ||
| 7843 | 9년 전 | 402 | ||
| 7842 | 9년 전 | 389 | ||
| 7841 | 9년 전 | 374 | ||
| 7840 | 9년 전 | 390 | ||
| 7839 | 9년 전 | 425 | ||
| 7838 | 9년 전 | 507 | ||
| 7837 | 9년 전 | 345 | ||
| 7836 | 9년 전 | 391 | ||
| 7835 | 9년 전 | 461 | ||
| 7834 |
|
9년 전 | 1184 | |
| 7833 | 9년 전 | 412 | ||
| 7832 | 9년 전 | 405 | ||
| 7831 | 9년 전 | 544 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기