<?
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년 전 | 4123 | ||
| 429 | 19년 전 | 3321 | ||
| 428 | 19년 전 | 4140 | ||
| 427 | 19년 전 | 3488 | ||
| 426 | 19년 전 | 3112 | ||
| 425 | 19년 전 | 3425 | ||
| 424 | 19년 전 | 2450 | ||
| 423 | 19년 전 | 2874 | ||
| 422 | 19년 전 | 2365 | ||
| 421 | 19년 전 | 3720 | ||
| 420 | 19년 전 | 4753 | ||
| 419 | 19년 전 | 3823 | ||
| 418 |
|
19년 전 | 1760 | |
| 417 | 19년 전 | 2761 | ||
| 416 | 19년 전 | 2403 | ||
| 415 | 19년 전 | 2613 | ||
| 414 | 19년 전 | 4428 | ||
| 413 |
|
19년 전 | 2621 | |
| 412 | 19년 전 | 3063 | ||
| 411 |
|
19년 전 | 3001 | |
| 410 |
|
19년 전 | 3706 | |
| 409 |
|
19년 전 | 3650 | |
| 408 |
|
19년 전 | 1869 | |
| 407 | 19년 전 | 2241 | ||
| 406 | 19년 전 | 2805 | ||
| 405 | 19년 전 | 2473 | ||
| 404 | 19년 전 | 4322 | ||
| 403 | 19년 전 | 3313 | ||
| 402 |
NeoGenesis
|
19년 전 | 4110 | |
| 401 | 19년 전 | 2618 | ||
| 400 |
|
19년 전 | 2512 | |
| 399 | 19년 전 | 2973 | ||
| 398 | 19년 전 | 2507 | ||
| 397 | 19년 전 | 2798 | ||
| 396 | 19년 전 | 2505 | ||
| 395 | 19년 전 | 3205 | ||
| 394 | 19년 전 | 1747 | ||
| 393 | 19년 전 | 3006 | ||
| 392 | 19년 전 | 2282 | ||
| 391 | 19년 전 | 2188 | ||
| 390 | 19년 전 | 2299 | ||
| 389 | 19년 전 | 2657 | ||
| 388 | 19년 전 | 2201 | ||
| 387 | 19년 전 | 4493 | ||
| 386 |
|
19년 전 | 2699 | |
| 385 |
|
19년 전 | 2508 | |
| 384 | 19년 전 | 3041 | ||
| 383 | 19년 전 | 3073 | ||
| 382 | 19년 전 | 3122 | ||
| 381 |
|
19년 전 | 2648 | |
| 380 |
|
19년 전 | 3030 | |
| 379 | 19년 전 | 2557 | ||
| 378 | 19년 전 | 2225 | ||
| 377 | 19년 전 | 2790 | ||
| 376 | 19년 전 | 2476 | ||
| 375 |
|
19년 전 | 2573 | |
| 374 | 19년 전 | 3832 | ||
| 373 | 19년 전 | 3285 | ||
| 372 | 19년 전 | 5004 | ||
| 371 |
세은아빠2
|
19년 전 | 2426 | |
| 370 | 19년 전 | 4508 | ||
| 369 | 19년 전 | 3120 | ||
| 368 | 19년 전 | 2920 | ||
| 367 | 19년 전 | 3745 | ||
| 366 | 19년 전 | 2671 | ||
| 365 | 19년 전 | 3756 | ||
| 364 | 19년 전 | 4027 | ||
| 363 | 19년 전 | 3461 | ||
| 362 | 19년 전 | 3497 | ||
| 361 | 19년 전 | 4119 | ||
| 360 |
hwatta
|
19년 전 | 2379 | |
| 359 | 19년 전 | 5123 | ||
| 358 | 19년 전 | 3670 | ||
| 357 | 20년 전 | 2614 | ||
| 356 |
sdesign1s
|
20년 전 | 2294 | |
| 355 | 20년 전 | 2775 | ||
| 354 | 20년 전 | 3040 | ||
| 353 | 20년 전 | 2807 | ||
| 352 |
|
20년 전 | 5787 | |
| 351 |
|
20년 전 | 2722 | |
| 350 |
|
20년 전 | 4310 | |
| 349 |
hwatta
|
20년 전 | 2196 | |
| 348 | 20년 전 | 7319 | ||
| 347 | 20년 전 | 2424 | ||
| 346 | 20년 전 | 3517 | ||
| 345 | 20년 전 | 4325 | ||
| 344 | 20년 전 | 2665 | ||
| 343 | 20년 전 | 3933 | ||
| 342 | 20년 전 | 3080 | ||
| 341 | 20년 전 | 4111 | ||
| 340 |
|
20년 전 | 5163 | |
| 339 |
|
20년 전 | 4249 | |
| 338 | 20년 전 | 5896 | ||
| 337 | 20년 전 | 2056 | ||
| 336 |
|
20년 전 | 3344 | |
| 335 |
|
20년 전 | 3563 | |
| 334 |
|
20년 전 | 2958 | |
| 333 |
hwatta
|
20년 전 | 2461 | |
| 332 | 20년 전 | 4667 | ||
| 331 | 20년 전 | 2292 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기