我在第4行中得到一個錯誤,大括號。從我所知道的支架需要在那裏。我怎樣才能解決這個問題 ?我如何修復我的註冊腳本中的錯誤
<?php
include('config.php');
// for the registration script we need a html form
if($_SERVER['REQUEST_METHOD'] == 'POST' {
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string(md5($_POST['password']));
//retrieve the input from the user and encrypt the password with md5
} if(empty($username)) {
echo("Please enter a Username");
} else {
if(empty($password)) {
echo("Please enter a password");
} else {
//check if username already exists
$query = mysql_query("SELECT * FROM users WHERE username='$username'");
$rows = mysql_num_rows($query);
//with mysql_query you call a sql command
if($rows > 0) {
die("Username taken !!");
} else {
$user_input = mysql_query("INSERT INTO users (username , password) VALUES ('$username' , '$password')");
echo("Successfully Registered ");
}
}
}
?>
您在哪個環境下編程?也許Netbeans是一個想法?它會幫助你進行調試。 – Pakspul
我使用記事本++我試過其他程序,如aptana studio和netbeans,但是我誠實地喜歡記事本++,僅僅是因爲它的簡單 – user3208543