<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1430 | 18년 전 | 2976 | ||
| 1429 | 18년 전 | 2923 | ||
| 1428 | 18년 전 | 2818 | ||
| 1427 | 18년 전 | 2128 | ||
| 1426 |
|
18년 전 | 2310 | |
| 1425 |
|
18년 전 | 2864 | |
| 1424 |
|
18년 전 | 2957 | |
| 1423 |
frotone
|
18년 전 | 4120 | |
| 1422 | 18년 전 | 6114 | ||
| 1421 | 18년 전 | 2047 | ||
| 1420 | 18년 전 | 2178 | ||
| 1419 | 18년 전 | 1886 | ||
| 1418 | 18년 전 | 1649 | ||
| 1417 | 18년 전 | 2631 | ||
| 1416 | 18년 전 | 1692 | ||
| 1415 | 18년 전 | 1559 | ||
| 1414 | 18년 전 | 4734 | ||
| 1413 | 18년 전 | 1787 | ||
| 1412 | 18년 전 | 1833 | ||
| 1411 | 18년 전 | 1843 | ||
| 1410 | 18년 전 | 1968 | ||
| 1409 | 18년 전 | 3625 | ||
| 1408 | 18년 전 | 1648 | ||
| 1407 | 18년 전 | 1519 | ||
| 1406 | 18년 전 | 1350 | ||
| 1405 | 18년 전 | 1853 | ||
| 1404 | 18년 전 | 1899 | ||
| 1403 |
frotone
|
18년 전 | 3645 | |
| 1402 | 18년 전 | 1973 | ||
| 1401 | 18년 전 | 3106 | ||
| 1400 | 18년 전 | 4727 | ||
| 1399 | 18년 전 | 2858 | ||
| 1398 | 18년 전 | 8043 | ||
| 1397 | 18년 전 | 4053 | ||
| 1396 |
|
18년 전 | 2738 | |
| 1395 | 18년 전 | 1520 | ||
| 1394 | 18년 전 | 2618 | ||
| 1393 | 18년 전 | 5036 | ||
| 1392 | 18년 전 | 5218 | ||
| 1391 |
cncafe
|
18년 전 | 2089 | |
| 1390 |
mixdesign
|
18년 전 | 4348 | |
| 1389 | 18년 전 | 4089 | ||
| 1388 |
mixdesign
|
18년 전 | 4141 | |
| 1387 | 18년 전 | 2261 | ||
| 1386 | 18년 전 | 4182 | ||
| 1385 |
mixdesign
|
18년 전 | 2169 | |
| 1384 | 18년 전 | 3276 | ||
| 1383 | 18년 전 | 4909 | ||
| 1382 | 18년 전 | 1946 | ||
| 1381 |
오디세우스
|
18년 전 | 3404 | |
| 1380 |
mixdesign
|
18년 전 | 1635 | |
| 1379 | 18년 전 | 2732 | ||
| 1378 |
mixdesign
|
18년 전 | 1657 | |
| 1377 | 18년 전 | 2707 | ||
| 1376 |
|
18년 전 | 2549 | |
| 1375 |
|
18년 전 | 1550 | |
| 1374 |
|
18년 전 | 1489 | |
| 1373 |
|
18년 전 | 1733 | |
| 1372 | 18년 전 | 2236 | ||
| 1371 | 18년 전 | 2012 | ||
| 1370 | 18년 전 | 2375 | ||
| 1369 | 18년 전 | 4913 | ||
| 1368 |
mixdesign
|
18년 전 | 1815 | |
| 1367 | 18년 전 | 1255 | ||
| 1366 | 18년 전 | 1376 | ||
| 1365 | 18년 전 | 1330 | ||
| 1364 | 18년 전 | 1077 | ||
| 1363 | 18년 전 | 1075 | ||
| 1362 | 18년 전 | 1403 | ||
| 1361 | 18년 전 | 1357 | ||
| 1360 | 18년 전 | 2346 | ||
| 1359 | 18년 전 | 1222 | ||
| 1358 | 18년 전 | 1605 | ||
| 1357 | 18년 전 | 2090 | ||
| 1356 | 18년 전 | 1273 | ||
| 1355 | 18년 전 | 2826 | ||
| 1354 | 18년 전 | 1269 | ||
| 1353 | 18년 전 | 1646 | ||
| 1352 | 18년 전 | 1496 | ||
| 1351 | 18년 전 | 1447 | ||
| 1350 | 18년 전 | 1231 | ||
| 1349 | 18년 전 | 1076 | ||
| 1348 | 18년 전 | 1663 | ||
| 1347 | 18년 전 | 1102 | ||
| 1346 | 18년 전 | 3614 | ||
| 1345 | 18년 전 | 1708 | ||
| 1344 |
mixdesign
|
18년 전 | 1787 | |
| 1343 | 18년 전 | 1113 | ||
| 1342 | 18년 전 | 1848 | ||
| 1341 | 18년 전 | 1093 | ||
| 1340 | 18년 전 | 1163 | ||
| 1339 | 18년 전 | 1013 | ||
| 1338 | 18년 전 | 1001 | ||
| 1337 | 18년 전 | 1094 | ||
| 1336 |
|
18년 전 | 2575 | |
| 1335 | 18년 전 | 1544 | ||
| 1334 | 18년 전 | 1636 | ||
| 1333 | 18년 전 | 1201 | ||
| 1332 | 18년 전 | 1871 | ||
| 1331 | 18년 전 | 1516 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기