일부 프로젝트의 양식을 만들고 있습니다. 문제는 사용자가 입력란을 사용하여 데이터를 입력 한 다음 입력을 데이터베이스에 보관하지 않을 때입니다. 또한 직접 제출 페이지를 클릭하면 연결 테스트도 표시되지 않는 빈 페이지가 빈 페이지로 표시됩니다. 다른 프로젝트와 거의 비슷한 코드를 사용하고 있으며이 코드는 제외됩니다.데이터가 데이터베이스에 삽입되지 않습니다.
<?php
//check connection
require 'config.php';
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
//asas (table name)
$id = $_POST["Sid"]; $ic = $_POST["Sic"];
$name = $_POST["Snp"]; $jant = $_POST["J1"];
$trum = $_POST["Chr"];$tbim = $_POST["Chp"];
$mel = $_POST["Sem"]; $arum = $_POST["Ar"];
$asum = $_POST["As"];
//institusi
$thp = $_POST["T1"]; $uni = $_POST["Sis"];
$bid = $_POST["tpe"];$Aint = $_POST["Ai"];
//industri
$bip = $_POST["bid"];$bik = $_POST["B1"];
$tem = $_POST["te"];$mula = $_POST["tm"];
$tamm = $_POST["tt"]; $res = $_POST["fileToUpload1"];
$tran = $_POST["fileToUpload2"];$keb = $_POST["fileToUpload3"];
$link = mysqli_connect($h,$u,$p,$db);
if('id' != '$Sid'){
$asas = "insert into asas Values ('$id','$ic','$name','$jant','$trum','$tbim','$mel','$arum','$asum')";
$inst = "insert into institusi Values ('$thp','$uni','$bid','$Aint')";
$indr = "insert into industri Values ('$bip','$bik','$tem','$mula','$tamm','$res','$tran','$keb')";
mysqli_query($link,$asas);
mysqli_query($link,$inst);
mysqli_query($link,$indr);
mysqli_close($link);
}
else
{
echo "failed"
}
?>
<b>Register complete</b>
아무도 말해 줄 수있는 오류 또는 어쩌면 몇 가지 솔루션 : 은 아래에있는 내 코드입니다. 감사합니다
[PHP 감사합니다. 오류. Log.] (http://stackoverflow.com/questions/5438060/showing-all-errors-and-warnings/5438125#5438125) – mkaatman
제출 후이 페이지로 이동하지 않을 수도 있습니다. –
@Nexz 귀하의 코드는 SQL 삽입 공격에 취약합니다. Prepared Statements 사용을 고려하십시오. http://php.net/manual/en/mysqli.prepare.php –