我有這個項目在DBMS上。我的表單正在工作,如果我輸入正確的用戶名和密碼..但它只顯示一個空白頁面,當我輸入錯誤的細節..它不執行其他部分..它如果部分工作正常..任何人都可以幫助我..我是PHP新手。其他部分不執行在PHP如果條件
<html>
<head>
<title></title>
</head>
<body>
<?php
include 'connection.php';
SESSION_START();
$user = $_POST['registeredEmail'];
$pass = $_POST['registeredpassword'];
$sql = "SELECT * FROM users WHERE email = '".$user."' and password = '".$pass."';";
$qry = mysql_query($sql) or die(mysql_error());
$result = mysql_fetch_array($qry) or die(mysql_error());
if($result)
{
$_SESSION['UserName'] = $result['name'];
echo '<script type="text/javascript">';
echo 'alert("Sign In Successful");';
echo 'window.location.href = "sell.php";';
echo '</script>';
}
else
{
// header('Location: index.php');
echo 'sign in unsuccessful';
echo '<script type="text/javascript">';
echo 'alert("Sign In UnSuccessful. Either Email or password or both are wrong.. please try again or Sign Up");';
echo 'window.location.href = "index.php";';
echo '</script>';
}
?>
</body>
</html>
你看過你的源代碼嗎?你的網頁真的是空白嗎? – Rizier123 2015-04-03 13:02:49
請您在做任何其他事情之前閱讀此http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php。 – 2015-04-03 13:04:54