其所以haaaaaaaaaaaaaard解決這個不確定:(..我該如何解決這個傢伙..未定義指數誤差PHP
這是我的PHP代碼
<?php
$con = mysqli_connect("localhost", "root", "lns123", "lnsdb");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "INSERT INTO tblreservation(position,tel,menu1,name,Add2,birth,civil,sex,height,weight,emailadd,religion,spouse,soccupation,father,foccupation,mother,moccupation,address,elem,date,high,hdate,college,course,skills,frm,to2,eposition,company)VALUES('$_POST[position]','$_POST[tel]','$_POST[menu1]','$_POST[name]','$_POST[Add2]','$_POST[birth]','$_POST[civil]','$_POST[sex]','$_POST[height]','$_POST[weight]','$_POST[emailadd]','$_POST[religion]','$_POST[spouse]','$_POST[soccupation]','$_POST[father]','$_POST[foccupation]','$_POST[mother]','$_POST[moccupation]','$_POST[address]','$_POST[elem]','$_POST[date]','$_POST[high]','$_POST[hdate]','$_POST[college]','$_POST[course]','$_POST[skills]','$_POST[frm]','$_POST[to2]','$_POST[eposition]','$_POST[company]')";
if (!mysqli_query($con, $sql)) {
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
和錯誤都是不確定的指數線146
這是線146
$sql="INSERT INTO tblreservation(position,tel,menu1,name,Add2,birth,civil,sex,height,weight,emailadd,religion,spouse,soccupation,father,foccupation,mother,moccupation,address,elem,date,high,hdate,college,course,skills,frm,to2,eposition,company)VALUES('$_POST[position]','$_POST[tel]','$_POST[menu1]','$_POST[name]','$_POST[Add2]','$_POST[birth]','$_POST[civil]','$_POST[sex]','$_POST[height]','$_POST[weight]','$_POST[emailadd]','$_POST[religion]','$_POST[spouse]','$_POST[soccupation]','$_POST[father]','$_POST[foccupation]','$_POST[mother]','$_POST[moccupation]','$_POST[address]','$_POST[elem]','$_POST[date]','$_POST[high]','$_POST[hdate]','$_POST[college]','$_POST[course]','$_POST[skills]','$_POST[frm]','$_POST[to2]','$_POST[eposition]','$_POST[company]')";
HELP ME GUYS :(謝謝
Oy公司,OY OY OY OY ....請請請上閱讀起來(HTTP [SQL注入!]: //stackoverflow.com/questions/601300/what-is-sql-injection) - 你的代碼嚴重**易受攻擊。 – Lix
SQL注入,我向你致敬! – raina77ow
此外,您應該驗證您希望在'$ _POST'中的所有參數是否真的存在... – Lix