insert문 질문입니다.

insert문 질문입니다.

QA

insert문 질문입니다.

답변 2

본문

평소 php7버전 사용중입니다. 연습할때는 잘 입력되었는데

이번에는 잘 안되서 고수분들께 조언을 구하고자합니다.

확인해보니 적용해야할곳 php버전은 5.5.17입니다.


$M_tit = $_GET['match_tit'];
    $M_day = $_GET['match_day'];
    $M_home = $_GET['match_home'];
    $M_away = $_GET['match_away'];
    $M_score = $_GET['match_score'];
 
    $sql = "INSERT INTO g5_match(
        match_tit,
        match_day,
        match_home,
        match_away,
        match_score,
    ) value (
        '$M_tit',
        '$M_day',
        '$M_home',
        '$M_away',
        '$M_score',
    )";

이 쿼리문인데#1064 - 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 '$sql = "INSERT INTO g5_match( match_tit, match_day, m' at line 1 처럼 오류가 나고있습니다. 

 

 

이 질문에 댓글 쓰기 :

답변 2

match_score,

'$M_score',

같이 마지막 항목에는 , 제거해주시고
인서트오류의대부분은 오타라던가 db테이블과 name이 틀리다던가 가끔 형식에 맞지않게 내용을 는다던가하는 경우가있슴

  $sql = "INSERT INTO g5_match(
        match_tit,
        match_day,
        match_home,
        match_away,
        match_score
    ) value (
        '$M_tit',
        '$M_day',
        '$M_home',
        '$M_away',
        '$M_score'
    )";
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 129,102
© SIRSOFT
현재 페이지 제일 처음으로