database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
ㆍInformix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Informix Q&A 1300 게시물 읽기
No. 1300
[급합니다] 울고 싶어요. 도와주세요
작성자
김민지
작성일
2002-02-25 15:47
조회수
6,521

게시판을 만들고 있는데...

제대로 안되고 미치겠습니다.

 

저는 인포믹스를 사용하고 있구...

PHP 로 게시판을 만들고 있습니다.

제발 봐주세요..

 

board_write.php 로 글을 쓰고 저장버튼 클릭하면

board_list.php로 글이 올라가야 하는데...

전혀 올라가질 않고..

 

아래와 같은 에러 메세지가 나타납니다.

Warning: Prepare fails (E [SQLSTATE=42 000 SQLCODE=-201]) in /usr/local/apache/htdocs/myung/mtboard.php on line 90

E [SQLSTATE=42 000 SQLCODE=-201]게시판의 리스트를 가지고 올 수 없습니다.

 

테이블만 제대로 보임.

 

 

Fatal error: Call to undefined function: off() in /usr/local/apache/htdocs/myung/mtboard.php on line 195

 

---- mtboard.php 소스 ----

<?

 

require("./board.ini");

 

class mtboard

{

var $con=false;

var $rlt;

var $allarticle; //전체 글 개수

var $alllist; //전체 리스트 개수

var $mode;

var $keywork;

 

 

function mtboard($mode="", $keyword="")

{

global $server, $userid, $passid, $bd_num_article;

 

$this->mode = $mode;

$this->keyword=$keyword;

$this->con=ifx_connect($server, $userid, $passid);

 

 

if(!$this->con)

die ("데이터베이스와 연결이 되지 않습니다.");

 

 

 

if(strlen($this->mode) && strlen($this->keyword)){

$search = $this->makeSearchSQL($this->mode,$this->keyword);

$que= "select count(*) from board $search";

}

else $que = "select count(*) from board";

 

$rlt = ifx_prepare($que, $this->con);

if(!ifx_do($rlt)){

echo ifx_error();

die ("전체 글의 개수를 알수 없습니다.");

return;

}

else {

 

$tmp = ifx_fetch_row($rlt);

 

$this->allarticle=(int)$tmp["(count(*))"];

 

ifx_free_result($rlt);

 

//전체 글 리스트의 개수

$this->alllist=$this->allarticle / $bd_num_article;

$this->alllist = (int)$this->alllist;

 

$mod = $this->allarticle % $bd_num_article;

if($mod!=0)

++$this->alllist;

}

 

//답변글

// session_start();

}

 

function close()

{

@ifx_free_result($this->rlt);

ifx_close($this->con);

}

 

function getlist($list)

{

global $bd_num_article;

 

$tmplist=($list-1) * $bd_num_article;

 

if(strlen($this->mode) && strlen($this->keyword)) {

$search = $this->makeSearchSQL($this->mode, $this->keyword);

$que = "select num, parent_id, child_id, title, name, date, readed

from board $search order by parent_id DESC, child_id ASC";

}

else {

$que="select num, parent_id, child_id, title, name, date, readed

from $board order by parent_id DESC, child_id ASC";

}

 

 

if(!$this->rlt = ifx_query($que, $this->con)) { ======> 90

echo ifx_error();

echo ("게시판의 리스트를 가지고 올 수 없습니다.<br>");

return ;

}

 

/* $rlt = ifx_prepare($que, $this->con);

if(!ifx_do($rlt)){

echo ifx_error();

die ("게시판의 리스트를 가지고 올 수 없습니다.");

} */

 

//lists의 오브젝트 생성

$rtnlists=new lists($list, $this->mode, $this->keyword);

 

//현재 리스트 글 개수

$rtnlists->num_articles = $list==$this->alllist ?

$this->allarticle-($bd_num_article*($list-1)) : 15;

 

 

if($list>1)

for($i=$tmplist; $i>0 ; --$i)

$row = ifx_fetch_row($this->rlt, "next");

 

for($i=0; $i<$rtnlists->num_articles; ++$i){

$row = ifx_fetch_row($this->rlt, "next");

 

//주의요망

$row[Xnum] = $this->allarticle-$tmplist-$i;

$rtnlists->article[$i] = $row;

}

 

ifx_free_result($this->rlt);

return $rtnlists;

}

 

 

 

//읽은글 1증가시키기

function readed($num)

{

$que="update board set readed = readed+1 where num=$num";

 

if(!$this->rlt = ifx_query($que, $this->con)){

echo "글의 읽은 수를 +1 올릴 수 없습니더<br>";

echo ifx_error();

return;

}

 

}

 

 

 

function getarticle($num, $list)

{

//글 가져오기

$que = "select num, parent_id, child_id, title, content, name, date, readed

from board where num=$num";

 

if(!$this->rlt = ifx_query($que, $this->con)){

echo "게시판의 글을 가지고 올 수 업심더";

echo ifx_error();

return;

}

 

$row = ifx_fetch_row($this->rlt, "first");

ifx_free_result($this->rlt);

 

if(strlen($this->mode) && strlen($this->keyword))

$rtnarticle= new article($row, $list, $mode, $keyword);

else

$rtnarticle= new article($row, $list);

 

//같은 부모글에 달린 형제글 개수 가져오기

$que = "select count(*) from board where parent_id=$row[parent_id]";

 

if($this->rlt = ifx_query($que, $this->con))

{

//형제글 개수

$tmp= ifx_fetch_row($this->rlt);

$rtnarticle->num_brother = $tmp["(count(*))"];

 

$que = "select num, parent_id, child_id, title, name, date, readed

from board where parent_id=$row[parent_id] order by child_id ASC";

 

$this->rlt = ifx_query($que, $this->con);

 

for($i=0; $i<$rtnarticle->num_brother; ++$i){

$rtnarticle->brother[] = ifx_fetch_row ($this->rlt, "next");

}

ifx_free_result($this->rlt);

}

else $rtnarticle->num_brother= 0;

return $rtnarticle;

}

 

 

 

function eclistlink($list=1)

{

global $htmlist, $bd_num_article, $bd_num_list;

 

//리스트 시작

if($list%$bd_num_list)

{

$start_list=off($list, 1, $bd_num_list) +1; =======>195

}

else

$start_list=$list-$bd_num_list+1;

//리스트 끝

$end_list=min($start_list + $bd_num_list, $this->alllist);

 

for($i=$start_list; $i<=$end_list; ++$i)

{

if($i != $list)

{

if(strlen($this->mode) && strlen($this->keyword))

$arg="list=".$i."&mode=".$this->mode."&keyword=".$this->keyword;

else

$arg= "list=".$i ;

$link="<font size=2>[".taghyperlink($i,$htmlist,$arg)."]</font>";

echo $link;

}else {

$str = "<font size=3><b><i>&nbsp".$i."&nbsp</i></b></font>";

echo $str;

}

}

}

 

//현재 리스트에서 이전으로

function ecbeforelistlink($list)

{

global $htmlist, $bd_num_list;

 

if($list>$bd_num_list){

$list=off($list, 1, $bd_num_list) - $bd_num_list + 1;

 

if(strlen($this->mode) && strlen($this->keyword))

$arg = "list=".$list."&mode=".$this->mode."&keyword=".$this->keyword;

else

$arg="list=".$list;

 

$link="<font size=2>".taghyperlink ("<_before",$htmlist,$arg)."</font>";

echo $link;

}

}

 

function ecnextlistlink($list)

{

global $htmlist, $bd_num_list;

 

$list=up($list, 1, $bd_num_list) +1;

 

if($list <= $this->alllist)

{

if(strlen($this->mode)&& strlen($this->keyword))

$arg="list=".$list."&mode=".$this->mode."&keyword=".$this->keyword;

else

$arg="list=".$list;

$link="<font size=2>".taghyperlink("next_>",$htmlist,$arg)."</font>";

echo $link;

}

}

 

function eccurrentlistlink($list)

{

global $htmlist;

 

if(strlen($this->mode)&& strlen($this->keyword))

$arg="list=".$list."&mode=".$this->mode."&keyword=".$this->keyword;

else

$arg="list=".$list;

 

$link="<font size=2>".taghyperlink("<img src='./img/list.gif' border=0 >", $htmlist, $arg)."</font>";

 

echo $link;

}

 

 

function ecfirstlistlink()

{

global $htmlist;

 

$link ="<font size=2>".taghyperlink("<img src='./img/list.gif' border=0 width='85' height='17' align='absmiddle'>",

$htmlist)."</font>";

 

echo $link;

}

 

function ecnewwrite($list)

{

global $htmwrite;

 

$link=taghyperlink("<img src='./img/write.gif'>", $htmwrite, "list=".$list);

 

echo $link;

}

 

 

function ecmodify()

{

global $htmmodify;

 

$link= taghyperlink("<img src='./img/modify.gif'>", $htmmodify, "list=".$list."&no=".$this->article[no]);

 

echo $link;

}

 

 

function delete($num, $password)

{

$password = crypt($password, $password);

 

$que="select num from board where num=$num and password='$password'";

 

$this->rlt = ifx_prepare($que, $this->con);

ifx_do($this->rlt);

 

ifx_fetch_row($this->rlt);

 

$num_row= ifx_num_rows($this->rlt);

 

if(ifx_num_rows($this->rlt)){

ifx_free_result($this->rlt);

 

$que="delete from board where num=$num";

return ifx_query($que, $this->con);

}

else return false;

}

 

 

function modify($name,

$password,

$title,

$content,

$num)

{

$password = crypt($password, $password);

 

//암호가 맞는지

$que = "select num from board where num=$num and password='$password'";

 

$this->rlt = ifx_query($que, $this->con);

 

ifx_fetch_row($this->rlt);

 

if(ifx_num_rows($this->rlt))

{

ifx_free_result($this->rlt);

 

$title=htmlspecialchars($title);

$name=addslashes($name);

$title=addslashes($title);

$content=addslashes($content);

 

$blob_content=ifx_create_blob(1, 0, $content);

$blob_id[] = $blob_content;

 

$que="update board set title='$title', name='$name', content=? where num='$num'";

 

return ifx_query($que, $this->con, $blob_id);

}

else return false;

}

 

//글쓰기

function write($name,

$password,

$title,

$content,

$email,

$homepage)

{

$que="select max(parent_id) from board";

$this->rlt = ifx_query($que, $this->con);

 

$parent_id = ifx_fetch_row($this->rlt, "first");

$max_parent_id = $parent_id["(max)"] + 1;

 

ifx_free_result($this->rlt);

 

$title=htmlspecialchars($title);

$name=addslashes($name);

$title=addslashes($title);

$content=addslashes($content);

 

 

$date=date("Y.m.t");

$time=date("h:i:s");

$password=crypt($password, $password);

 

$blob_content=ifx_create_blob(1, 0, $content);

$blob_id[] = $blob_content;

 

$que="insert into board(parent_id, name, title, content, date, time, password, email, homepage) values

('$max_parent_id','$name','$title',?,'$date', '$time', '$password','$email', $url)";

 

$rid=ifx_prepare($que, $this->con, $blob_id);

 

if(!ifx_do($rid)){

echo "글쓰기에 문제가 째끔 있네요";

echo ifx_error();

return;

}

}

 

//수정

function replywrite($name,

$password,

$title,

$content,

$parent_id,

$ori_child_id,

$depth)

{

$que="select child_id from board where parent_id=$parent_id and child_id like

'".$ori_child_id."_' order by child_id DESC";

 

$this->rlt = ifx_prepare($que, $this->con);

ifx_do($this->rlt);

 

if(@ifx_num_rows($this->rlt)){

$child_id = ifx_fetch_row($this->rlt, "FIRST");

$child_id=$child_id[child_id];

ifx_free_result($this->rlt);

 

$tmp = $child_id[$depth];

$tmp = ord($tmp) + 1;

$child_id[$depth] = chr($tmp);

}

else $child_id = $ori_child_id."A";

 

$title=htmlspecialchars($title);

 

$name=addslashes($name);

$title=addslashes($title);

$content=addslashes($content);

 

$blob_content=ifx_create_blob(1, 0, $content);

$blob_id[] = $blob_content;

 

$date = date("Y.m.t");

$time=date("h:i:s");

$password=crypt($password, $password);

 

 

$que="insert into board(parent_id, child_id, name, title, content, date, time, password) values

('$parent_id','$child_id','$name','$title',?,'$date', '$time', '$password')";

 

$rid=ifx_prepare($que, $this->con, $blob_id);

 

if(!ifx_do($rid)){

echo "답글 쓰기에 문제가 있습니다.";

echo ifx_error();

}

}

 

 

function makeSearchSQL($mode, $keyword)

{

switch($mode)

{

case 0:

$que = "title like '%$keyword%'";

break;

case 1:

$que = "content like '%$keyword%'";

break;

case 2:

$que = "name like '%$keyword%'";

break;

}

 

return "where".$que;

}

 

}

 

 

 

class lists

{

var $article;

var $num_articles;

 

var $mode;

var $keyword;

 

var $list;

 

function lists($list, $mode, $keyword)

{

$this->list = $list;

$this->mode= $mode;

$this->keyword = $keyword;

 

}

 

function getarticle($number= 0){

if(strlen($this->mode) && srtlen($this->keyword))

$rtn = new article($this->article[$number], $this->list, $this->mode, $this->keyword);

else

$rtn= new article($this->article[$number], $this->list);

 

return $rtn;

}

}

 

 

 

class article

{

var $article;

var $list;

var $mode;

var $keyword;

 

var $num_brother;

var $brother;

 

function article($article, $list, $mode="", $keyword="")

{

$this->list=$list;

$this->list=$mode;

$this->keyword=$keyword;

 

$this->article=$this->filter($article);

 

}

 

 

function filter($row)

{

global $htmread, $bd_title_length;

 

if(isset($row[content]))

{

$row[content] = stripslashes($row[content]);

$row[Hcontent] = nl2br($row[content]);

$row[Hcontent] =

tagreplaceemaillink($row[Hcontent]);

$row[Hcontent] =

tagreplacehttplink($row[Hcontent]);

$row[Hcontent] = tagreplaceftplink($row[Hcontent]);

}

 

$row[depth] = strlen($row[child_id]);

$row[htitle] = stripslashes($row[title]);

$row[htitle] = ksubstr($row[htitle], 0, $bd_title_length);

 

if(strlen($this->mode) && strlen($this->keyword)){

$row[htitle] = taghyperlink($row[htitle], $htmread,

 

"list=".$this->list."$parent_id=".$row[parent_id].

"$num=".$row[num]."$mode=".$this->mode."&keyword=".$this->keyword);

}

 

else{

$row[htitle] = taghyperlink($row[htitle], $htmread, "list=".$this->list.

"&parent_id=".$row[parent_id]. "&num=".$row[num]);

}

 

$row[name] = stripslashes($row[name]);

$row[email]=stripslashes($row[email]);

 

$row[email] = tagemaillink($row[email], $row[email]);

 

return $row;

}

 

 

function getbrother($i)

{

if($i>$this->num_brother || $i<0 || $this-> num_brother<2)

return false;

 

if(strlen($this->mode) && strlen($this->keyword))

$rtn = new article($this->brother[$i], $this->list, $this->mode, $this->keyword);

 

else

$rtn = new article($this->brother[$i], $this->list);

 

return $rtn;

}

 

 

function ecreplywrite()

{

global $htmreplywrite, $child_id, $depth, $ori_num, $parent_id;

 

$child_id = $this->article[child_id];

$depth = $this->article[depth];

$ori_num = $this->article[num];

$parent_id = $this->article[parent_id];

 

 

session_start();

 

session_register("parent_id");

session_register("child_id");

/* session_register("depth"); */

session_register("ori_num");

 

$link = taghyperlink("<img src='./img/write.gif'>", $htmreplywrite, "list=".$this->list);

 

echo $link;

 

}

 

function ecmodify()

{

global $htmmodify;

 

$link = taghyperlink("<img src='./img/modify.gif'>", $htmmodify,

"list=".$this->list."&num=".$this->article[num]);

 

echo $link;

}

 

 

function ecdelete()

{

global $htmdelete;

 

$link = taghyperlink("<img src='./img/delete.gif'>", $htmdelete,

"list=".$this->list."&num=".$this->article[num]);

 

echo $link;

 

}

 

};

 

 

 

?>

[Top]
No.
제목
작성자
작성일
조회
1318[잡담?] 여기 계신분들 Informix 는 어떤 OS 에서 사용하시나요?
박지호
2002-02-27
4286
1319┕>Re: [잡담?] 여기 계신분들 Informix 는 어떤 OS 에서 사용하시나요?
김건수
2002-02-27 12:03:05
5070
1317[질문] 스크립트로 돌리는 프로시저를...
이선희
2002-02-26
4600
1320┕>Re: [질문] 스크립트로 돌리는 프로시저를...
김건수
2002-02-27 13:10:54
5691
1301초보 informix 입니다.
informix
2002-02-25
4460
1309┕>Re: 초보 informix 입니다.
김건수
2002-02-26 16:05:31
4948
1300[급합니다] 울고 싶어요. 도와주세요
김민지
2002-02-25
6521
1307┕>Re: [급합니다] 울고 싶어요. 도와주세요
김건수
2002-02-26 15:57:12
9087
1298쿼리좀 봐주세요 [1]
이승열
2002-02-22
5132
1313┕>Re: 쿼리좀 봐주세요
이진우
2002-02-26 16:39:44
6144
1297blob data asp에서 처리방법은요??
윤봉승
2002-02-20
5590
1308┕>Re: blob data asp에서 처리방법은요?? [1]
김건수
2002-02-26 15:59:50
7389
1295JDBC 연결시 에러 남니다.( 쩜 급해서요! )
주성철
2002-02-19
6344
1305┕>Re: JDBC 연결시 에러 남니다.( 쩜 급해서요! )
prolin
2002-02-26 09:47:44
6404
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.4로 자료를 관리합니다