본문 바로가기

카테고리 없음

한줄 게시판 DB쪽 보내는 소스

<?

//insert update delete


switch($_GET['proc']) {

case "insert" :

$strSQL = " INSERT ji_board (txtContents, dateReg, dateEdit) VALUES ('".addslashes($_POST['ji_context'])."', '".date('Y-m-d H:i:s')."', '".date('Y-m-d H:i:s')."'); ";

//

$strText = "저장되었습니다";

break;

case "update" :

$strSQL = "UPDATE ji_board SET txtContents = '".addslashes($_POST['ji_context'])."' WHERE dwSeq= ".$_GET['seq'].";  "; 

$strText = "수정되었습니다.";

break;

case "delete" :

$strSQL = "DELETE FROM ji_board WHERE dwSeq= ".$_GET['seq']."; ";

$strText = "삭제되었습니다..";

break;

}

echo $strSQL;

exit;

$MYDB = mysqli_connect("","","","") or die("Error " . mysqli_error($MYDB)); 

if($MYDB->query($strSQL) === false) {

$strText = "DB반영에 실패하였습니다.";

}

?>

<html>

<head>

<title>Test board</title>

</head>

<body>

<h1>DB 처리</h1>

<div>

<?=$strText?>

</div>

<a href="./board.php">이전으로</a>

</body>

</html>