반응형
이 코드를 실행할 때이 오류가 발생하며 데이터베이스에 특정 필터를 추가하는 데 사용합니다.
<?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
반응형
'MySql' 카테고리의 다른 글
MySQL 이 PDO 준비 문은 false를 반환하지만 오류를 발생시키지 않습니다. (0) | 2020.12.02 |
---|---|
MySQL-mysqldump-루틴은 모든 루틴이 아닌 하나의 저장 프로 시저 (이름 별) 만 내보내는 루틴 (0) | 2020.12.02 |
MySQL MAMP Pro에서 Apache가 시작되지 않음 (0) | 2020.12.02 |
MySQL ALTER TABLE이있는 저장 프로 시저 (0) | 2020.12.02 |
MySQL 어레이에 데이터베이스 결과 추가 (0) | 2020.12.02 |
댓글