语法错误,第34行的C:\ xampp \ htdocs \ latihan \ Prosesdaftar.php中出现意外的'else'(T_ELSE)
<?php
require_once("koneksi.php");
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysql_query("SELECT * FROM user WHERE username = '$username'");
if(mysql_num_rows($cekuser) > 0) {
echo "Username Sudah Terdaftar!";
echo "Masih ada data yang kosong!";
echo '<a href="daftar.php">Back</a>';
} else {
if(!$username || !$pass) {
$simpan = mysql_query("INSERT INTO user(username, password) VALUES('$username','$pass')");
echo '<a href="daftar.php">Back</a>';
} else {
if($simpan) {
}
echo 'Pendaftaran Sukses, Silahkan <a href="login.php">Login</a>';
} else {
echo "Proses Gagal!";
}
}
?>
echo 'Pendaftaran Sukses, Silahkan <a href="login.php">Login</a>';
} else {
问题在于“其他”我该怎么办?
答案 0 :(得分:-1)
没有else{}
之前不能有if{}
,因此仅else {echo "Proses"; }
是不正确的