当我试图创建一个登录系统时,我收到了这个错误: Impossibile interrogare il database No such file or directoryPHP过程代码是这样的:<?php session_start();include('db-conn-dashboard.php');$nomeutente = $_POST['nomeutente'];$password = $_POST['password'];$nomeutente = stripcslashes($nomeutente);$password = stripcslashes($password);$nomeutente = mysql_real_escape_string($nomeutente);$password = mysql_real_escape_string($password);$result = mysql_query("SELECT * FROM profili WHERE nomeutente = '$nomeutente' and password = '$password'") or die("Impossibile interrogare il database ".mysql_error());$row = mysql_fetch_array($result);if($row['nomeutente'] == $nomeutente && $row['password'] == $password){ $_SESSION['login_user1'] = "autorizzato1"; $_SESSION['autorizzato'] = 1; header('location: ../pages/home.php');} else { echo '<script type="text/javascript">alert("Nome utente o password errati. Riprova.") window.location= "../pages/login.php"</script>';}?>形式是这样的:<form role="form" action="../php/processo-accesso.php" method="POST"> <fieldset> <div class="form-group"> <input class="form-control" placeholder=" Nome utente" name="nomeutente" type="text" style="font-family: fontawesome, arial;" onkeyup="this.value = this.value.toUpperCase();" required> </div> <div class="form-group"> <input class="form-control" placeholder=" Password" style="font-family: fontawesome, arial;" name="password" type="password" required> </div> <input type="submit" name="accedi" class="btn btn-primary" value="Accedi" style="width: 100%;"> </fieldset> </form>
1 回答

倚天杖
TA贡献1828条经验 获得超3个赞
尝试这个
$sql= mysql_query("SELECT * FROM profili WHERE nomeutente = '$nomeutente' and password = '$password'")
or die("Impossibile interrogare il database ".mysql_error());
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
- 1 回答
- 0 关注
- 111 浏览
添加回答
举报
0/150
提交
取消