본문 바로가기
MySql

MySQL 구문 분석 오류 : 구문 오류, 예기치 않은 'INTO'(T_STRING) 7 행

by 베이스 공부 2020. 12. 2.
반응형

이 코드를 실행할 때이 오류가 발생하며 데이터베이스에 특정 필터를 추가하는 데 사용합니다.

       <?php

//Connect to Databaseeee
    $con=mysqli_connect("127.0.0.1","root","Toom13371!","filter_database_test");
    if (mysqli_connect_errno($con))
        {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
        }

        // sql insertationerino
        $sql = INSERT INTO filterlist ('type_code', 'connector_type', 'construction_type', 'author', 'estimate_lead_time', 'last_update', 'confidence_level', 'passtype', 'start_passband', 'stop_passband', 'low_stopband', 'high_stopband', 'low_passband', 'high_passband', 'start_stopband', 'stop_stopband') VALUES ('".$_POST['type_code']."', '".$_POST['connector_type']."', '".$_POST['construction_type']."', '".$_POST['author']."', '".$_POST['estimate_lead_time']."', '".$_POST['last_update']."', '".$_POST['confidence_level']."', '".$_POST['passtype']."', '".$_POST['start_passband']."', '".$_POST['stop_passband`']."', '".$_POST['low_stopband']."', '".$_POST['high_stopband']."', '".$_POST['low_passband']."', '".$_POST['high_passband']."', '".$_POST['start_stopband']."', '".$_POST['start_stopband']."');
            if (!mysqli_query($con,$sql))
            {
            die('Error: ' . mysqli_error($con));
            }
        echo "1 Filter Added";
        mysqli_close($con);
        ?>

전체 오류는 다음과 같습니다.

구문 분석 오류 : 7 행의 C : \ xampp \ htdocs \ html \ addprocess.php의 구문 오류, 예기치 않은 'INTO'(T_STRING)

 

해결 방법

 

우선 php의 기초를 배워야합니다.


다음과 같이 시도하십시오.

$sql = "INSERT INTO filterlist (`type_code`, `connector_type`, `construction_type`, 
`author`, `estimate_lead_time`, `last_update`, `confidence_level`, `passtype`, 
 `start_passband`, `stop_passband`, `low_stopband`, `high_stopband`, `low_passband`, 
 `high_passband`, `start_stopband`, `stop_stopband`) VALUES 
 ('".mysqli_real_escape_string($con,$_POST['type_code'])."', 
 '".mysqli_real_escape_string($con,$_POST['connector_type'])."', 
 '".mysqli_real_escape_string($con,$_POST['construction_type'])."', 
 '".mysqli_real_escape_string($con,$_POST['author'])."',  
 '".mysqli_real_escape_string($con,$_POST['estimate_lead_time'])."', 
 '".mysqli_real_escape_string($con,$_POST['last_update'])."', 
 '".mysqli_real_escape_string($con,$_POST['confidence_level'])."', 
 '".mysqli_real_escape_string($con,$_POST['passtype'])."', 
 '".mysqli_real_escape_string($con,$_POST['start_passband'])."', 
 '".mysqli_real_escape_string($con,$_POST['stop_passband`'])."', 
 '".mysqli_real_escape_string($con,$_POST['low_stopband'])."', 
 '".mysqli_real_escape_string($con,$_POST['high_stopband'])."', 
 '".mysqli_real_escape_string($con,$_POST['low_passband'])."', 
 '".mysqli_real_escape_string($con,$_POST['high_passband'])."', 
 '".mysqli_real_escape_string($con,$_POST['start_stopband'])."', 
 '".mysqli_real_escape_string($con,$_POST['start_stopband'])."')";


if (!mysqli_query($con,$sql)){
            die('Error: ' . mysqli_error($con));
   }
  echo "1 Filter Added";
  mysqli_close($con);

 

참조 페이지 https://stackoverflow.com/questions/25199444

 

 

반응형

댓글