0
我是PHP新手。我之前做了一些工作,但沒有太多。現在,我有IIS服務器安裝在我的機器,它消耗端口80因爲這個原因,我在配置文件中已經改變了瓦帕服務器的端口。在PHP中使用mysqli_connect服務器超時/登錄錯誤
現在,我已經是一個簡單的登錄form.The的HTML標記看起來是這樣的:
<?php
session_start();
if(isset($_REQUEST["error"])){
?>
<script type="text/javascript">
alert("Username and/or Password is incorrect!Please try again!");
</script>
<?php
}
?>
<html>
<head>
<body>
<form method="post" action="verifyUser.php">
<div class="container">
<div class="card card-container">
<!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
<img id="profile-img" class="profile-img-card" src="//ssl.gstatic.com/accounts/ui/avatar_2x.png" />
<p id="profile-name" class="profile-name-card"></p>
<form class="form-signin">
<span id="reauth-email" class="reauth-email"></span>
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus><br>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div id="remember" class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button class="btn btn-lg btn-primary btn-block btn-signin" type="submit">Sign in</button>
</form><!-- /form -->
<a href="#" class="forgot-password">
Forgot the password?
</a>
<br>
</div><!-- /card-container -->
</div><!-- /container -->
</form>
</body>
</html>
和PHP文件,verifyUser.php
看起來是這樣的:
<?php
session_start();
$email = $_POST["email"];
$pass = $_POST["password"];
$con = mysqli_connect("localhost","root","","user",8080) or die("Some error occurred during connection " . mysqli_error($con));
$result_row = mysqli_query($con,"select * from info where Email='$email' and Password='$pass'");
if($row = mysqli_fetch_array($result_row)){
$_SESSION["existing_user"] = $row['Name'];
$_SESSION["email"] = $row['Email'];
header("location : home.php");
}
else{
header("location:form1.php?error=1");
}
?>
現在,當我嘗試登錄時,出現錯誤:
警告:mysqli_connect():MySQL服務器用C消失:\ WAMP \ WWW \ verifyUser.php線路7
我的錯誤畫面是這樣的:
我研究這個錯誤,並嘗試了所有的替代品,這似乎並沒有工作。其中一個是在php.ini文件中作出一些更改,但似乎也不工作!
誰能告訴我這是爲什麼實際上發生和解決方案呢?
天啊!非常感謝!我把它和wamp服務器的端口混合在一起..再次感謝你..我會在7分鐘內接受你的回答 –
歡迎你:) –
直到那時,你能否提供我很好的學習PHP的參考?除了官方文檔頁面 –