내 코드는 양식에서 게시 된 값을 표에 삽입하는 코드입니다. 코드 :PHP 코드로 외래 키 필드에 값을 삽입하려면 어떻게해야합니까?
1 $email1 = $_POST['txtemail'];
2 $user1 = $_POST['txtuser'];
3 $date1 = $_POST['txtdate'];
4 $subject1 = $_POST['txtsubject'];
5 $percent = $_POST['txtpercent'];
6 $percent1 = (string) $percent;
7 $query = "insert into personal_record values '','$email1','$user1','$date1','$subject1','$percent1'";
8 $result = mysql_query($query,$link);
이 내 코드이며 오류 제공합니다
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 ''','[email protected]','Jugal','29 Mar 2011 13:28:42','jquery','40'' at line 1
최대한 빨리 제발 도와주세요 ...! 도와주세요.
을 : 값 주위에 괄호를 배치 시작할 수 있습니다 그것은'VALUES (.....) 할 필요가' –
또한, 귀하의 코드에 취약 [SQL 주입 (HTTP ://stackoverflow.com/questions/601300/what-is-sql-injection). –