猿问

没有这样的文件或目录:我该如何解决这个问题?

当我试图创建一个登录系统时,我收到了这个错误: Impossibile interrogare il database No such file or directory


PHP过程代码是这样的:


<?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="&#xf007;  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="&#xf084;  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>


MMMHUHU
浏览 112回答 1
1回答

倚天杖

尝试这个$sql= mysql_query("SELECT * FROM profili WHERE nomeutente = '$nomeutente' and password = '$password'")&nbsp; &nbsp; or die("Impossibile interrogare il database ".mysql_error());$result=mysql_query($sql);$row=mysql_fetch_array($result);
随时随地看视频慕课网APP
我要回答