2017-02-01 54 views
-1

因此,我正在創建我的第一個網站,並在我的註冊表單中提交數據時,我的文檔的第43行中出現一個錯誤,指出「文件意外結束」。我一直在尋找錯誤,但我沒有找到任何我的知識。我查看了本網站上的其他線索,並檢查了作爲解決方案提供給他人的問題。沒有。誰能幫忙?這是我的代碼。意外的文件援助結束

<?php 
session_start(); 
include '../dbh.php'; 

$first = $_POST['first']; 
$last = $_POST['last']; 
$email = $_POST['email']; 
$uid = $_POST['uid']; 
$pwd = $_POST['pwd']; 

if (empty($first)){ 
    header("Location:../signin.php?error=empty"); 
    exit(); 
} 
if (empty($last)){ 
header("Location:../signin.php?error=empty"); 
exit(); 
} 
if (empty($email)){ 
    header("Location:../signin.php?error=empty"); 
    exit(); 
} 
if (empty($uid)){ 
    header("Location:../signin.php?error=empty"); 
    exit(); 
} 
if (empty($pwd)){ 
    header("Location:../signin.php?error=empty"); 
    exit(); 
    } else{ 
     $sql ="SELECT uid FROM user WHERE uid='$uid'"; 
     $result = $conn->query($sql); 
     $uidcheck = mysqli_num_rows($result); 
     if ($uidcheck > 0){ 
     header("Location:../signin.php?error=username"); 
     exit(); 
} else { 
    $sql = "INSERT INTO user (first, last, email, uid, pwd) 
    VALUES ('$first', '$last', '$email', '$uid', '$pwd')"; 
    $result = $conn->query($sql); 

    header("Location:../index.php"); 
+0

您錯過了最後一個關閉}?> – Kaylined

回答

0

添加以下兩行:

} 
?> 

到腳本的結尾。