새로운 테이블 생성 후 글쓰기 저장 오류 질문드립니다~!
본문
연습삼아
새로 테이블을 생성해서
직접 글쓰기 글보기 글목록을 만들어보려구하는데요..잘안되네요..
현재 글쓰기 업로드에서 db 업로드가 안되서 질문드립니다!
아래 소스 참조합니다!
===========글쓰기
<?php$sub_menu = "400100";
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g5['title'] = '채널관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$sql = "SELECT * FROM channel";
$view = sql_fetch($sql);
if (count($view) == 1) echo"없음";
?>
<!-- 게시물 작성/수정 시작 { -->
<form name="fwrite" id="fwrite" action="/adm/channel_update.php" method="post" >
<input type="hidden" name="id" value="<?php echo $id;?>"
<td>제목 <input type="text" name="name" id="name" required class="frm_input required" size="10" maxlength="20"></td>
<input type="submit" value="글작성" >
</form>
<?php
include_once ('./admin.tail.php');
?>
=================글저장
<?
include_once('./_common.php');
if ( !$name)//제목, 글내용, 이름 입력체크
{
echo(" <script>
window.alert('이름, 제목, 내용을 입력해 주세요 !')
history.go(-1)
</script>
");
exit ;
}
$sql = "SELECT * FROM channel";
$result = mysql_query($sql, $connect);
//쿼리전송
$row = mysql_fetch_array($result);
//레코드를 배열로 저장
//글번호 증가
if ($row[0]) {
$id = $row[0] + 1;
} else {
$id = 1;
}
//-------저장
$writeday = time();
$sql = "insert into board (id,name, content, etc, thumb)
values('$id','$name','$content','$etc','$thumb')";
$result=mysql_query($sql, $connect);
if($result)
{
Header("Location:/adm/channel_list.php"); // list.php 로 이동
}
else
{
echo("<script language=javascript>
window.alert('저장중 오류');
history.go(-1);
</script>");
exit;
}
?>
답변을 작성하시기 전에 로그인 해주세요.