1:1 게시판을 추가하려고 합니다. DB 저장/불러오기가 안됩니다 ㅜ
본문
다른용도로 쓸 1:1 게시판을 하나 더 만들고 있는데요
디비와 필드는 만들어졌는데 읽고 쓰기가 안됩니다
3일째 보고 있는데 왜그런지 이유를 모르겠습니다 ㅠㅠ
기존의 qa_config.php를 수정하고 있습니다.
data 폴더의 dbconfig에서 아래와 같이 추가해줬구요
$g5['invest_config_table'] = G5_TABLE_PREFIX.'invest_config'; // 상업용 부동산투자 설정 설정테이블
$g5['invest_content_table'] = G5_TABLE_PREFIX.'invest_content'; // 상업용 부동산투자 설정 테이블
현재 config 전체 구문인데 어느 부분이 문제인지 모르겠네요
sql 쪽 문제 같은데 당췌 이유를 모르겠네요 ㅠㅜ
<?php
$sub_menu = "300900";
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
auth_check($auth[$sub_menu], 'r');
$token = get_token();
$g5['title'] = '상업용 부동산투자 설정';
include_once ('./admin.head.php');
// DB 테이블 생성
if(!sql_query(" DESCRIBE `{$g5['invest_config_table']}` ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['invest_config_table']}` (
`invest_title` varchar(255) NOT NULL DEFAULT'',
`invest_category` varchar(255) NOT NULL DEFAULT'',
`invest_skin` varchar(255) NOT NULL DEFAULT '',
`invest_mobile_skin` varchar(255) NOT NULL DEFAULT '',
`invest_use_email` tinyint(4) NOT NULL DEFAULT '0',
`invest_req_email` tinyint(4) NOT NULL DEFAULT '0',
`invest_use_hp` tinyint(4) NOT NULL DEFAULT '0',
`invest_req_hp` tinyint(4) NOT NULL DEFAULT '0',
`invest_use_sms` tinyint(4) NOT NULL DEFAULT '0',
`invest_send_number` varchar(255) NOT NULL DEFAULT '',
`invest_admin_hp` varchar(255) NOT NULL DEFAULT '',
`invest_use_editor` tinyint(4) NOT NULL DEFAULT '0',
`invest_subject_len` int(11) NOT NULL DEFAULT '0',
`invest_mobile_subject_len` int(11) NOT NULL DEFAULT '0',
`invest_page_rows` int(11) NOT NULL DEFAULT '0',
`invest_mobile_page_rows` int(11) NOT NULL DEFAULT '0',
`invest_image_width` int(11) NOT NULL DEFAULT '0',
`invest_upload_size` int(11) NOT NULL DEFAULT '0',
`invest_insert_content` text NOT NULL,
`invest_include_head` varchar(255) NOT NULL DEFAULT '',
`invest_include_tail` varchar(255) NOT NULL DEFAULT '',
`invest_content_head` text NOT NULL,
`invest_content_tail` text NOT NULL,
`invest_mobile_content_head` text NOT NULL,
`invest_mobile_content_tail` text NOT NULL,
`invest_1_subj` varchar(255) NOT NULL DEFAULT '',
`invest_2_subj` varchar(255) NOT NULL DEFAULT '',
`invest_3_subj` varchar(255) NOT NULL DEFAULT '',
`invest_4_subj` varchar(255) NOT NULL DEFAULT '',
`invest_5_subj` varchar(255) NOT NULL DEFAULT '',
`invest_1` varchar(255) NOT NULL DEFAULT '',
`invest_2` varchar(255) NOT NULL DEFAULT '',
`invest_3` varchar(255) NOT NULL DEFAULT '',
`invest_4` varchar(255) NOT NULL DEFAULT '',
`invest_5` varchar(255) NOT NULL DEFAULT ''
)", true);
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['invest_content_table']}` (
`invest_id` int(11) NOT NULL AUTO_INCREMENT,
`invest_num` int(11) NOT NULL DEFAULT '0',
`invest_parent` int(11) NOT NULL DEFAULT '0',
`invest_related` int(11) NOT NULL DEFAULT '0',
`mb_id` varchar(20) NOT NULL DEFAULT '',
`invest_name` varchar(255) NOT NULL DEFAULT '',
`invest_email` varchar(255) NOT NULL DEFAULT '',
`invest_hp` varchar(255) NOT NULL DEFAULT '',
`invest_type` tinyint(4) NOT NULL DEFAULT '0',
`invest_category` varchar(255) NOT NULL DEFAULT '',
`invest_email_recv` tinyint(4) NOT NULL DEFAULT '0',
`invest_sms_recv` tinyint(4) NOT NULL DEFAULT '0',
`invest_html` tinyint(4) NOT NULL DEFAULT '0',
`invest_subject` varchar(255) NOT NULL DEFAULT '',
`invest_content` text NOT NULL,
`invest_status` tinyint(4) NOT NULL DEFAULT '0',
`invest_file1` varchar(255) NOT NULL DEFAULT '',
`invest_source1` varchar(255) NOT NULL DEFAULT '',
`invest_file2` varchar(255) NOT NULL DEFAULT '',
`invest_source2` varchar(255) NOT NULL DEFAULT '',
`invest_ip` varchar(255) NOT NULL DEFAULT '',
`invest_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`invest_1` varchar(255) NOT NULL DEFAULT '',
`invest_2` varchar(255) NOT NULL DEFAULT '',
`invest_3` varchar(255) NOT NULL DEFAULT '',
`invest_4` varchar(255) NOT NULL DEFAULT '',
`invest_5` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`invest_id`),
KEY `invest_num_parent` (`invest_num`,`invest_parent`)
)", true);
}
$sql = " SHOW COLUMNS FROM `{$g5['invest_content_table']}` LIKE 'invest_content' ";
$row = sql_fetch($sql);
if(strpos($row['Type'], 'text') === false) {
sql_query(" ALTER TABLE `{$g5['invest_content_table']}` CHANGE `invest_content` `invest_content` text NOT NULL ", true);
}
$investconfig = get_invest_config();
if(empty($investconfig)) {
$sql = " insert into `{$g5['invest_config_table']}`
( invest_title, invest_category, invest_skin, invest_mobile_skin, invest_use_email, invest_req_email, invest_use_hp, invest_req_hp, invest_use_editor, invest_subject_len, invest_mobile_subject_len, invest_page_rows, invest_mobile_page_rows, invest_image_width, invest_upload_size, invest_insert_content )
values
( '상업용 부동산투자설정', '투자문의|투자신청', 'basic', 'basic', '1', '0', '1', '0', '1', '60', '30', '15', '15', '600', '1048576', '' ) ";
sql_query($sql);
$investconfig = get_invest_config();
}
// 관리자 이메일필드 추가
if(!isset($investconfig['invest_admin_email'])) {
sql_query(" ALTER TABLE `{$g5['invest_config_table']}`
ADD `invest_admin_email` varchar(255) NOT NULL DEFAULT '' AFTER `invest_admin_hp` ", true);
}
// 상단 하단 설정 필드 추가
if(!isset($investconfig['invest_include_head'])) {
sql_query(" ALTER TABLE `{$g5['invest_config_table']}`
ADD `invest_include_head` varchar(255) NOT NULL DEFAULT '' AFTER `invest_insert_content`,
ADD `invest_include_tail` varchar(255) NOT NULL DEFAULT '' AFTER `invest_include_head`,
ADD `invest_content_head` text NOT NULL AFTER `invest_include_tail`,
ADD `invest_content_tail` text NOT NULL AFTER `invest_content_head`,
ADD `invest_mobile_content_head` text NOT NULL AFTER `invest_content_tail`,
ADD `invest_mobile_content_tail` text NOT NULL AFTER `invest_mobile_content_head` ", true);
}
?>
<form name="finvestconfigform" id="finvestconfigform" method="post" onsubmit="return finvestconfigform_submit(this);" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token ?>" id="token">
<section id="anc_cf_invest_config">
<h2 class="h2_frm">1:1문의 설정</h2>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>1:1문의 설정</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="invest_title">타이틀<strong class="sound_only">필수</strong></label></th>
<td>
<input type="text" name="invest_title" value="<?php echo $investconfig['invest_title'] ?>" id="invest_title" required class="required frm_input" size="40">
<a href="<?php echo G5_BBS_URL; ?>/investlist.php" class="btn_frmline">1:1문의 바로가기</a>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_category">분류<strong class="sound_only">필수</strong></label></th>
<td>
<?php echo help('분류와 분류 사이는 | 로 구분하세요. (예: 질문|답변) 첫자로 #은 입력하지 마세요. (예: #질문|#답변 [X])') ?>
<input type="text" name="invest_category" value="<?php echo $investconfig['invest_category'] ?>" id="invest_category" required class="required frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_skin">스킨 디렉토리<strong class="sound_only">필수</strong></label></th>
<td>
<?php echo get_skin_select('invest', 'invest_skin', 'invest_skin', $investconfig['invest_skin'], 'required'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_mobile_skin">모바일 스킨 디렉토리<strong class="sound_only">필수</strong></label></th>
<td>
<?php echo get_mobile_skin_select('invest', 'invest_mobile_skin', 'invest_mobile_skin', $investconfig['investa_mobile_skin'], 'required'); ?>
</td>
</tr>
<tr>
<th scope="row">이메일 입력</th>
<td>
<input type="checkbox" name="invest_use_email" value="1" id="invest_use_email" <?php echo $investconfig['invest_use_email']?'checked':''; ?>> <label for="invest_use_email">보이기</label>
<input type="checkbox" name="invest_req_email" value="1" id="invest_req_email" <?php echo $investconfig['invest_req_email']?'checked':''; ?>> <label for="invest_req_email">필수입력</label>
</td>
</tr>
<tr>
<th scope="row">휴대폰 입력</th>
<td>
<input type="checkbox" name="invest_use_hp" value="1" id="invest_use_hp" <?php echo $investconfig['invest_use_hp']?'checked':''; ?>> <label for="invest_use_hp">보이기</label>
<input type="checkbox" name="invest_req_hp" value="1" id="invest_req_hp" <?php echo $investconfig['invest_req_hp']?'checked':''; ?>> <label for="invest_req_hp">필수입력</label>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_use_sms">SMS 알림</label></th>
<td>
<?php echo help('휴대폰 입력을 사용하실 경우 문의글 등록시 등록자가 답변등록시 SMS 알림 수신을 선택할 수 있도록 합니다.<br>SMS 알림을 사용하기 위해서는 기본환경설정 > <a href="'.G5_ADMIN_URL.'/config_form.php#anc_cf_sms">SMS 설정</a>을 하셔야 합니다.') ?>
<select name="invest_use_sms" id="invest_use_sms">
<?php echo option_selected(0, $investconfig['invest_use_sms'], '사용안함'); ?>
<?php echo option_selected(1, $investconfig['invest_use_sms'], '사용함'); ?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_send_number">SMS 발신번호</label></th>
<td>
<?php echo help('SMS 알림 전송시 발신번호로 사용됩니다.'); ?>
<input type="text" name="invest_send_number" value="<?php echo $investconfig['invest_send_number'] ?>" id="invest_send_number" class="frm_input" size="30">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_admin_hp">관리자 휴대폰번호</label></th>
<td>
<?php echo help('관리자 휴대폰번호를 입력하시면 문의글 등록시 등록하신 번호로 SMS 알림이 전송됩니다.<br>SMS 알림을 사용하지 않으시면 알림이 전송되지 않습니다.'); ?>
<input type="text" name="invest_admin_hp" value="<?php echo $investconfig['invest_admin_hp'] ?>" id="invest_admin_hp" class="frm_input" size="30">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_admin_email">관리자 이메일</label></th>
<td>
<?php echo help('관리자 이메일을 입력하시면 문의글 등록시 등록하신 이메일로 알림이 전송됩니다.'); ?>
<input type="text" name="invest_admin_email" value="<?php echo $investconfig['invest_admin_email'] ?>" id="invest_admin_email" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_use_editor">DHTML 에디터 사용</label></th>
<td>
<?php echo help('글작성시 내용을 DHTML 에디터 기능으로 사용할 것인지 설정합니다. 스킨에 따라 적용되지 않을 수 있습니다.'); ?>
<select name="invest_use_editor" id="invest_use_editor">
<?php echo option_selected(0, $investconfig['invest_use_editor'], '사용안함'); ?>
<?php echo option_selected(1, $investconfig['invest_use_editor'], '사용함'); ?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_subject_len">제목 길이<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help('목록에서의 제목 글자수') ?>
<input type="text" name="invest_subject_len" value="<?php echo $investconfig['invest_subject_len'] ?>" id="invest_subject_len" required class="required numeric frm_input" size="4">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_mobile_subject_len">모바일 제목 길이<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help('목록에서의 제목 글자수') ?>
<input type="text" name="invest_mobile_subject_len" value="<?php echo $investconfig['invest_mobile_subject_len'] ?>" id="invest_mobile_subject_len" required class="required numeric frm_input" size="4">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_page_rows">페이지당 목록 수<strong class="sound_only"> 필수</strong></label></th>
<td>
<input type="text" name="invest_page_rows" value="<?php echo $investconfig['invest_page_rows'] ?>" id="invest_page_rows" required class="required numeric frm_input" size="4">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_mobile_page_rows">모바일 페이지당 목록 수<strong class="sound_only"> 필수</strong></label></th>
<td>
<input type="text" name="invest_mobile_page_rows" value="<?php echo $investconfig['invest_mobile_page_rows'] ?>" id="invest_mobile_page_rows" required class="required numeric frm_input" size="4">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_image_width">이미지 폭 크기<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help('게시판에서 출력되는 이미지의 폭 크기') ?>
<input type="text" name="invest_image_width" value="<?php echo $investconfig['invest_image_width'] ?>" id="invest_image_width" required class="required numeric frm_input" size="4"> 픽셀
</td>
</tr>
<tr>
<th scope="row"><label for="invest_upload_size">파일 업로드 용량<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help('최대 '.ini_get("upload_max_filesize").' 이하 업로드 가능, 1 MB = 1,048,576 bytes') ?>
업로드 파일 한개당 <input type="text" name="invest_upload_size" value="<?php echo $investconfig['invest_upload_size'] ?>" id="invest_upload_size" required class="required numeric frm_input" size="10"> bytes 이하
</td>
</tr>
<tr>
<th scope="row"><label for="invest_include_head">상단 파일 경로</label></th>
<td>
<input type="text" name="invest_include_head" value="<?php echo $investconfig['invest_include_head'] ?>" id="invest_include_head" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_include_tail">하단 파일 경로</label></th>
<td>
<input type="text" name="invest_include_tail" value="<?php echo $investconfig['invest_include_tail'] ?>" id="invest_include_tail" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="invest_content_head">상단 내용</label></th>
<td>
<?php echo editor_html("invest_content_head", get_text($investconfig['invest_content_head'], 0)); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_content_tail">하단 내용</label></th>
<td>
<?php echo editor_html("invest_content_tail", get_text($investconfig['invest_content_tail'], 0)); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_mobile_content_head">모바일 상단 내용</label></th>
<td>
<?php echo editor_html("invest_mobile_content_head", get_text($investconfig['invest_mobile_content_head'], 0)); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_mobile_content_tail">모바일 하단 내용</label></th>
<td>
<?php echo editor_html("invest_mobile_content_tail", get_text($investconfig['invest_mobile_content_tail'], 0)); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="invest_insert_content">글쓰기 기본 내용</label></th>
<td>
<textarea id="invest_insert_content" name="invest_insert_content" rows="5"><?php echo $investconfig['invest_insert_content'] ?></textarea>
</td>
</tr>
<?php for ($i=1; $i<=5; $i++) { ?>
<tr>
<th scope="row">여분필드<?php echo $i ?></th>
<td class="td_extra">
<label for="invest_<?php echo $i ?>_subj">여분필드 <?php echo $i ?> 제목</label>
<input type="text" name="invest_<?php echo $i ?>_subj" id="invest_<?php echo $i ?>_subj" value="<?php echo get_text($investconfig['invest_'.$i.'_subj']) ?>" class="frm_input">
<label for="invest_<?php echo $i ?>">여분필드 <?php echo $i ?> 값</label>
<input type="text" name="invest_<?php echo $i ?>" value="<?php echo get_text($investconfig['invest_'.$i]) ?>" id="invest_<?php echo $i ?>" class="frm_input">
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</section>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
</div>
</form>
<script>
function finvestconfigform_submit(f)
{
<?php echo get_editor_js("invest_content_head"); ?>
<?php echo get_editor_js("invest_content_tail"); ?>
<?php echo get_editor_js("invest_mobile_content_head"); ?>
<?php echo get_editor_js("invest_mobile_content_tail"); ?>
f.action = "./invest_config_update.php";
return true;
}
</script>
<?php
include_once ('./admin.tail.php');
?>
!-->!-->
답변 1
invest_config_update.php 파일에서
insert 또는 update 하는 쿼리아래에 echo $sql;exit;
하여 나오는 결과쿼리를 복사하여 phpmyadmin 이나 mysql 콘솔에서 직접 실행해서 쿼리에러가 없는지 먼저 확인해보세요.
답변을 작성하시기 전에 로그인 해주세요.