我的代码有什么问题
<?php
session_start();
require_once('koneksi.php');
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysqli_query($conn,"SELECT * FROM user WHERE username = '$username'");
$hasil = mysqli_fetch_array($cekuser);
if(mysqli_num_rows($cekuser) == 0) {
echo "<div align='center'>Username Belum Terdaftar! <a href='login.php'>Back</a></div>;
} else{
if($pass<>$hasil['$username]'){
echo "<div align='center'>Password Salah! <a href='login.php'>Back</a></div>;
} else{
$_SESSION['username']=$hasil['username'];
header('location:index.php');
}
}
?>
我收到这样的错误消息
解析错误:语法错误,意外的''(T_ENCAPSED_AND_WHITESPACE),在/storage/emulated/0/htdocs/proseslogin.php中的行中期望'-'或标识符(T_STRING)或变量(T_VARIABLE)或数字(T_NUM_STRING) 11
答案 0 :(得分:-1)
您在这里缺少结束语
echo "<div align='center'>Username Belum Terdaftar! <a href='login.php'>Back</a></div>;
还有这里
echo "<div align='center'>Password Salah! <a href='login.php'>Back</a></div>;
您需要关闭报价
echo "<div align='center'>Username Belum Terdaftar! <a href='login.php'>Back</a></div>";
echo "<div align='center'>Password Salah! <a href='login.php'>Back</a></div>";