<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4094 | ||
| 429 | 19년 전 | 3290 | ||
| 428 | 19년 전 | 4130 | ||
| 427 | 19년 전 | 3465 | ||
| 426 | 19년 전 | 3099 | ||
| 425 | 19년 전 | 3395 | ||
| 424 | 19년 전 | 2437 | ||
| 423 | 19년 전 | 2855 | ||
| 422 | 19년 전 | 2344 | ||
| 421 | 19년 전 | 3703 | ||
| 420 | 19년 전 | 4730 | ||
| 419 | 19년 전 | 3786 | ||
| 418 |
|
19년 전 | 1736 | |
| 417 | 19년 전 | 2740 | ||
| 416 | 19년 전 | 2387 | ||
| 415 | 19년 전 | 2603 | ||
| 414 | 19년 전 | 4402 | ||
| 413 |
|
19년 전 | 2589 | |
| 412 | 19년 전 | 3038 | ||
| 411 |
|
19년 전 | 2985 | |
| 410 |
|
19년 전 | 3675 | |
| 409 |
|
19년 전 | 3628 | |
| 408 |
|
19년 전 | 1848 | |
| 407 | 19년 전 | 2223 | ||
| 406 | 19년 전 | 2776 | ||
| 405 | 19년 전 | 2438 | ||
| 404 | 19년 전 | 4293 | ||
| 403 | 19년 전 | 3299 | ||
| 402 |
NeoGenesis
|
19년 전 | 4087 | |
| 401 | 19년 전 | 2602 | ||
| 400 |
|
19년 전 | 2486 | |
| 399 | 19년 전 | 2948 | ||
| 398 | 19년 전 | 2481 | ||
| 397 | 19년 전 | 2777 | ||
| 396 | 19년 전 | 2467 | ||
| 395 | 19년 전 | 3174 | ||
| 394 | 19년 전 | 1710 | ||
| 393 | 19년 전 | 2988 | ||
| 392 | 19년 전 | 2243 | ||
| 391 | 19년 전 | 2174 | ||
| 390 | 19년 전 | 2278 | ||
| 389 | 19년 전 | 2640 | ||
| 388 | 19년 전 | 2151 | ||
| 387 | 19년 전 | 4478 | ||
| 386 |
|
19년 전 | 2682 | |
| 385 |
|
19년 전 | 2475 | |
| 384 | 19년 전 | 3000 | ||
| 383 | 19년 전 | 3044 | ||
| 382 | 19년 전 | 3100 | ||
| 381 |
|
19년 전 | 2627 | |
| 380 |
|
19년 전 | 3011 | |
| 379 | 19년 전 | 2542 | ||
| 378 | 19년 전 | 2201 | ||
| 377 | 19년 전 | 2775 | ||
| 376 | 19년 전 | 2465 | ||
| 375 |
|
19년 전 | 2552 | |
| 374 | 19년 전 | 3807 | ||
| 373 | 19년 전 | 3261 | ||
| 372 | 19년 전 | 4984 | ||
| 371 |
세은아빠2
|
19년 전 | 2409 | |
| 370 | 19년 전 | 4495 | ||
| 369 | 19년 전 | 3104 | ||
| 368 | 19년 전 | 2889 | ||
| 367 | 19년 전 | 3721 | ||
| 366 | 19년 전 | 2641 | ||
| 365 | 19년 전 | 3728 | ||
| 364 | 19년 전 | 4005 | ||
| 363 | 19년 전 | 3428 | ||
| 362 | 19년 전 | 3471 | ||
| 361 | 19년 전 | 4100 | ||
| 360 |
hwatta
|
19년 전 | 2354 | |
| 359 | 19년 전 | 5096 | ||
| 358 | 19년 전 | 3651 | ||
| 357 | 19년 전 | 2590 | ||
| 356 |
sdesign1s
|
19년 전 | 2271 | |
| 355 | 20년 전 | 2742 | ||
| 354 | 20년 전 | 3025 | ||
| 353 | 20년 전 | 2785 | ||
| 352 |
|
20년 전 | 5766 | |
| 351 |
|
20년 전 | 2697 | |
| 350 |
|
20년 전 | 4284 | |
| 349 |
hwatta
|
20년 전 | 2178 | |
| 348 | 20년 전 | 7304 | ||
| 347 | 20년 전 | 2408 | ||
| 346 | 20년 전 | 3494 | ||
| 345 | 20년 전 | 4303 | ||
| 344 | 20년 전 | 2630 | ||
| 343 | 20년 전 | 3916 | ||
| 342 | 20년 전 | 3061 | ||
| 341 | 20년 전 | 4082 | ||
| 340 |
|
20년 전 | 5127 | |
| 339 |
|
20년 전 | 4226 | |
| 338 | 20년 전 | 5861 | ||
| 337 | 20년 전 | 2033 | ||
| 336 |
|
20년 전 | 3305 | |
| 335 |
|
20년 전 | 3532 | |
| 334 |
|
20년 전 | 2915 | |
| 333 |
hwatta
|
20년 전 | 2425 | |
| 332 | 20년 전 | 4651 | ||
| 331 | 20년 전 | 2262 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기