글수 583
| 큐브리드버젼 | CUBRID 2008 |
|---|---|
| 사용환경(OS) | 기타 |
function sql_prepare($sql, $params)
{
global $conn;
$req = cubrid_prepare( $conn, $sql ); //, CUBRID_INCLUDE_OID );
$i = 1;
//echo print_r($params)."<Br>";
foreach ($params as &$p) {
$res = cubrid_bind($req, $i, $p);
$i++;
}
return $req;
}
$sql = select * from board a, category b where a.board=b.board and a.id = b.id and a.board= ? and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between ? and ?
$params = Array ( "cool", 0, 35 )
$req = sql_prepare($sql, $params);
cubrid_execute($req);
while ($rs = cubrid_fetch($req)) <========= 이줄에서 오류가 납니다.
오류 메세지 :
Warning: Error: DBMS, -447, An operation has been attempted on a closed query result structure. in c:\board.php on line 196 Loading...
데이타는 잘 나오는데 무슨오류죠?
2010.02.03 15:49:53
정확한 쿼리 내용 입니다.
$sql = "select * board a, category b where a.code=b.code and a.id = b.id and a.code= ? and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between ? and ? ";
$params = Array ( "cool", 0, 35 ) ;
스키마는 다음과 같습니다.
CREATE TABLE "board"(
"id" integer NOT NULL,
"code" character varying(40) DEFAULT NOT NULL,
"num" integer DEFAULT 0 NOT NULL,
"reply" character varying(20) DEFAULT NOT NULL,
);
CREATE TABLE "category"(
"ca_id" integer AUTO_INCREMENT PRIMARY KEY,
"code" character varying(20) DEFAULT NOT NULL,
"id" integer DEFAULT 0 NOT NULL,
"ca_name" character varying(510) DEFAULT NOT NULL
);
$sql = "select * board a, category b where a.code=b.code and a.id = b.id and a.code= ? and a.id not in ( 249,248,247 ) order by num desc, reply asc for orderby_num() between ? and ? ";
$params = Array ( "cool", 0, 35 ) ;
스키마는 다음과 같습니다.
CREATE TABLE "board"(
"id" integer NOT NULL,
"code" character varying(40) DEFAULT NOT NULL,
"num" integer DEFAULT 0 NOT NULL,
"reply" character varying(20) DEFAULT NOT NULL,
);
CREATE TABLE "category"(
"ca_id" integer AUTO_INCREMENT PRIMARY KEY,
"code" character varying(20) DEFAULT NOT NULL,
"id" integer DEFAULT 0 NOT NULL,
"ca_name" character varying(510) DEFAULT NOT NULL
);
2010.02.10 16:44:38
안녕하세요.
해당 내용에 대한 답변은 재질문하신 곳에 답변을 달아드렸습니다. 간단히 말씀드리면 select 질의에 from 이 없어 질의 prepare시 에러가 발생한 내용입니다.
532번글 답변이 아직 없으셔서 다시 올립니다
해당 내용에 대한 답변은 재질문하신 곳에 답변을 달아드렸습니다. 간단히 말씀드리면 select 질의에 from 이 없어 질의 prepare시 에러가 발생한 내용입니다.
532번글 답변이 아직 없으셔서 다시 올립니다















$params = Array ( "cool", 0, 35 )
위 내용에서 "나 ', 그리고 ;는 원래 없는 건가요?
해당 sql 문장에서 사용된 쿼리의 스키마 정보를 올려주시면 문제 해결에 큰 도움이 될 것으로 보입니다.