我有一個問題,當 無法運行此程序, 它顯示PHP網站調試
Parse error: syntax error, unexpected 'username' (T_STRING) in C:\xampp\htdocs\fypp\index.php on line 9
<?php
session_start();
if (isset($_POST['bttLogin'])){
require 'connect.php';
$username = $_POST['username'];
$password = $_POST['password'];
$result = mysquli_query($con, 'select * from account where username="'.$username.'" and password="'.$password.'")
if(mysqli_num_rows($result)==1) {
$_SESSION['username'] = $username;
header("Location: welcome.php");
}
else
echo "account is invalid";
}
?>
<form method="post">
<table cellpadding="2" cellspacing="2" border="1">
<tr>
<td>Username</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password"" name="password"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="bttLogin" value="Login"></td>
</tr>
謝謝回答:)
SO的語法高亮已經顯示出來 – Ghost
我應該如何更正它:X謝謝 – xrina
'mysquli_query'沒有'mysquli'庫,有'mysql'。首先進行一些常規調試。 – Ohgodwhy