Mysql문의

Mysql문의

QA

Mysql문의

본문


<?php
include_once "**********";
$how = $_GET['how'];
$times = time();
$Bids = $_GET['Bids'];
$Sno = $_GET['Sno'];
$memoSno = $_GET['memoSno'];
$contents = $_GET['contents'];
print_r($_GET);
if($how == "reple"){
    $A = "INSERT INTO `alertmemo` (`memoSno`,`times`,`bid`,`sno`,`contents`) 
    VALUES (`".$memoSno."`,`".$times."`,`".$Bids."`,`".$Sno."`,`".$contents."`)";
    mysqli_query($conn,$A)or die(mysqli_error());
} // 답글에 댓글
else if($how == "edit"){
    
    
} // 수정
else if($how == "delete"){
    $A = "DELETE FROM alertmemo WHERE memoSno=`".$memoSno."`";
    mysqli_query($conn,$A);
    
    
} // 삭제
else if($how == "write"){
    $A = "INSERT INTO alertmemo ('contents','times','bid','sno','memoSno') VALUES ('".$contents."','".$times."','".$Bids."','".$Sno."','".$memoSno."')";
    
    mysqli_query($conn,$A);
    
    print mysqli_error($conn);
    
}  //댓글 작성
?>

위소스를 돌리면 아래 오류가 뿜어져 나오는데요 어디가 잘못 되 었 을 까요?


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''contents','times','bid','sno','memoSno') VALUES ('test','1660806739','TNBreview' at line 1

이 질문에 댓글 쓰기 :

답변 2



 // $A = "INSERT INTO alertmemo ('contents','times','bid','sno','memoSno') VALUES ('".$contents."','".$times."','".$Bids."','".$Sno."','".$memoSno."')";


 $A = "INSERT INTO alertmemo (`contents`,`times`,`bid`,`sno`,`memoSno`) VALUES ('".$contents."','".$times."','".$Bids."','".$Sno."','".$memoSno."')";

 

백틱으로 바꿔보세요

쿼리에 홑따옴표 쌍따옴표 같이 쓸필요가 없을텐데요..

그냥

 

$A = "INSERT INTO alertmemo ('contents','times','bid','sno','memoSno') VALUES ('$contents','$times','$Bids','$Sno','$memoSno')";

답변을 작성하시기 전에 로그인 해주세요.
전체 123,500 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT