홈페이지 게시판에 글쓰고 난 후 에러가 뜹니다. phpmyadmin 도와주세요~ 채택완료
안녕하세요 회사에서 홈페이지 관리업무를 맡게되었습니다.
원래 홈페이지 제작, 담당했던 업체랑 계약을 파기해버려서 제가 모든걸 다 해야 하는 상황입니다.
원래 디자인전공이라 잘 모르는 부분이 많은데요..
요근래 저희 홈페이지가 게시판을 하나 새로 만들었습니다.
기존에 있던 다른 게시판의 포맷을 복사해 같은 구조로 파일을 만들었고
카페24를 통해 ftp,웹 어드민을 들어갑니다.
새로 만든 게시판의 파일은 이렇게 7개가 있고요
new.html
new_deletePS.html
new_update.html
new_updatePS.html
new_veiw.html
new_write.html
new_writePS.html
여기서 에러가 나는 파일은 형광펜 밑줄 그은 두 파일입니다.
문제는 게시판에서 글 작성 후 글쓰기버튼을 누르면 에러가 납니다.
데이타베이스 에러: Invalid SQL: insert into board (idx, depth, etype, title, brief, content, member_uid, member_uname, reg_ip, isValid, regdate)
values ('0', '1', 'new', 'dd', '하하', '하하', 'id@test.com', '관리자', '59.14.56.38', 'y', '1411012518')
MySQL ERROR: 1054 (Unknown column 'etype' in 'field list')
Session halted.
--------------------------------------------------------------------
게시판 메뉴는 이렇습니다.

웹어드민을 보시면
display 테이블안에 필드는 이렇게 있습니다. 

---------------------------------------------------------------------
new.html과 new_write.html의 공통 상단 구문이고요
</span></font></p><p><span style="font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; line-height: normal;"><?php</span></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">@define('MEMBER_ONLY', 1);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/include.all.html';</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$url = "/display/new_list.html?curpage=".$curpage;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">if($_SESSION['MEM_TYPE'] != "A") {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>move_page('관리자만 등록이 가능합니다.', $url);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">}</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$fdb = new DB_jurassic;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$sdb = new DB_jurassic;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$etype = $_REQUEST['etype'];</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">//menu key</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$mNum = 2;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$sNum = 2;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">if($etype == "area") {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_navi = "구역별 전시물 정보";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_title = "<img src=\"/images/sub/sub3/title_menu1.gif\" />";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$sNum = 0;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">} else if($etype == "special") {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_navi = "특별 전시물";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_title = "<img src=\"/images/sub/sub3/title_menu2.gif\" />";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$sNum = 1;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">} else if($<span style="font-size: 10pt; background-color: rgb(237, 242, 194);">etype</span> == "<span style="font-size: 10pt; background-color: rgb(237, 242, 194);">new</span>") {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_navi = "새로운 화석";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$view_title = "<img src=\"/images/sub/sub3/title_menu5.gif\" />";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$sNum = 2;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">}</span></font></p><p> </p><p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</p><p> </p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$sql = "select idx from display where etype = '".$etype."' ".$add_qry;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$fdb->query($sql);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$total = $fdb->nf();
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">
new파일에 이런 구문이 있습니다 혹시 보시는데 도움이 될까하여 올려봅니다.
그리고 이건 new_writePS.html 파일입니다.
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><?php</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">@define('MEMBER_ONLY', 1);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/include.all.html';</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$fdb = new DB_jurassic;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$sdb = new DB_jurassic;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$today = time();</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$etype = "new";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$title =addslashes($_REQUEST['title']);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$tx_content = addslashes($_REQUEST['tx_content']);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$isValid = $_REQUEST['isValid'];</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">if(!$brief) {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$brief = cut_str(strip_tags($tx_content), 200);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$brief = str_replace(" ", "", $brief);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$brief = stripslashes(str_replace(" ", "", $brief));</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">}</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">// 내용을 입력한다.</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$sql = "insert into display (idx, depth, etype, title, brief, content, member_uid,member_uname, reg_ip, isValid, regdate) ";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$sql .= "values ";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$sql .= "('0', '1', '".$etype."', '".MakeDbStr($title)."', '".MakeDbStr($brief)."', '".MakeDbStr($tx_content)."', ";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$sql .= "'".$_SESSION['MEM_UID']."', '".MakeDbStr($_SESSION['MEM_NAME'])."', '".$_SERVER['REMOTE_ADDR']."', '".$isValid."', '".$today."')";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt; background-color: rgb(237, 242, 194);">$inChk = $fdb->query($sql);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">// 정보가 입력되면 </span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">if($inChk > 0) {<span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span></span></font></p><p><span class="Apple-tab-span" style="white-space: pre; line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><font face="Gulim" size="3"> </font></span></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>// 마지막으로 입력된 idx 구하기</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$sql = "select LAST_INSERT_ID() as lastNum";</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$fdb->query($sql);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$fdb->next_record();</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$lastNum = $fdb->f("lastNum");</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$url = "/display/new_view.html?idx=".$lastNum."&etype=".$etype;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>move_page('', $url);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">} else {</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>$url = "/display/new.html?etype=".$etype;</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"><span class="Apple-tab-span" style="white-space: pre; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;"> </span>move_page('오류가 발생하였습니다.', $url);</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">}</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal;">
</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$fdb->close();</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">$sdb->close();</span></font></p><p><font face="Gulim" size="3"><span style="line-height: normal; font-family: 나눔고딕, NanumGothic, sans-serif; font-size: 10pt;">?></span></font></p><p>
바쁘실테지만 잠깐 봐주시면 감사하겠습니다ㅠ_ㅠ
답변 3개
데이타베이스 에러: Invalid SQL: insert into board (idx, depth, etype, title, brief, content, member_uid, member_uname, reg_ip, isValid, regdate)
values ('0', '1', 'new', 'dd', '하하', '하하', 'id@test.com', '관리자', '59.14.56.38', 'y', '1411012518')
MySQL ERROR: 1054 (Unknown column 'etype' in 'field list')
Session halted.
1.필드리스트에 e타입이 없다.
2.세션오류!
phpmyadmin을 안써봐서 찾아보기도하고 제가 아는거도 알려드릴께요.
일단 session_start()를 위로 올리세요.(Session halted관련)
세션스타트 하기전에 내용이 출력되면 에러가나요. 세션내용을 db에 넣으려다 만들어지지도 않은 변수 사용하다 에러나서 내용이 출력되면 세션도 오류가나면서 돌고돌고.... 암튼 그렇져...
그리고 프라이머리,오토인크리먼트에 직접넣는거 idx는 빼세요.
일단 위에거 다 수정하신후에 나오는 오류를 다시 올려주세요.
한번에 한두개씩의 문제를 올려주셔야지 문제가 되는걸 다올린다음에 이거 다 해결해달라고 하시면 아무도 못해요~(진정한능력자는 될지도,,,)
몇개 해결하면 다른 오류가 없어질때도 생길때도 있는데 이런걸 하나하나 해결하셔야해요!! 한번에 해결하려다 체합니다!!
끝...
댓글을 작성하려면 로그인이 필요합니다.
이런건 제작의뢰에 맡겨야 할 듯하네요.. q&a에서 이러셔봐야 봐야 답안나와요
http://sir.co.kr/bbs/board.php?bo_table=request">http://sir.co.kr/bbs/board.php?bo_table=request
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인