소스코드가 PHP소스코드 입니다. 다른 PHP파일(html로구성 이 파일로 데이터 넘겨줌)에서 데이터를 받아
저렇게 데이터를 인서트를 하는데 정상적으로 DB에는 인서트가 잘 됩니다. 근데 문제는
저 페이지에서 자꾸 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 '1' at line 1에러가 뜨고 있습니다.
(`<는 붙여도 안붙여도 증상은 같습니다)
DB상에 저장은 되는데 왜 저런 에러가 뜨는지 알려주시면 감사하겠습니다..
저렇게 데이터를 인서트를 하는데 정상적으로 DB에는 인서트가 잘 됩니다. 근데 문제는
저 페이지에서 자꾸 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 '1' at line 1에러가 뜨고 있습니다.
(`<는 붙여도 안붙여도 증상은 같습니다)
DB상에 저장은 되는데 왜 저런 에러가 뜨는지 알려주시면 감사하겠습니다..
1 2 3 4 5 6 7 | 소스코드가 PHP소스코드 입니다. 다른 PHP파일(html로구성 이 파일로 데이터 넘겨줌)에서 데이터를 받아저렇게 데이터를 인서트를 하는데 정상적으로 DB에는 인서트가 잘 됩니다. 근데 문제는저 페이지에서 자꾸 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 '1' at line 1에러가 뜨고 있습니다. (`<는 붙여도 안붙여도 증상은 같습니다)DB상에 저장은 되는데 왜 저런 에러가 뜨는지 알려주시면 감사하겠습니다.. |
[ ▼ 질문관련 참고 Source ]
<?php$scY1=$_POST['scY'];$scT1=$_POST['scT']; //mysql = -hlocalhost -uroot -p1313$conn = mysqli_connect("localhost","root","1313","sched_db");if(mysqli_connect_errno()){echo"MySQL 연결 오류: ".mysqli_connect_error();}$sql=mysqli_query($conn,"INSERT INTO schedule1(`Year`,`schedT`) VALUES('$scY1','$scT1')"); if(!mysqli_query($conn,$sql)){die('Error: '.mysqli_error($conn));}else{echo"ok";} mysqli_close($conn);//echo("<meta http-equiv='Refresh' content='1; URL=th.php'>");?> |
|
답변 1개
채택된 답변
+20 포인트
아름다운세상
2015-02-27 (금) 19:22:10
$sql=mysqli_query($conn,"INSERT INTO schedule1(`Year`,`schedT`) VALUES('$scY1','$scT1')");
을
$sql="INSERT INTO schedule1(`Year`,`schedT`) VALUES('$scY1','$scT1')";
로 수정 후 해보세요
을
$sql="INSERT INTO schedule1(`Year`,`schedT`) VALUES('$scY1','$scT1')";
로 수정 후 해보세요
답변을 작성하려면 로그인이 필요합니다.