php - 用于登录的后端系统无法正常工作

标签 php mysql

我是 PHP 新手,还在学习中。当我为我的登录系统单击提交时,我没有看到任何迹象表明登录详细信息已被处理并发送到 MYSQL 后端(名为帐户的数据库)。有人可以帮助我并告诉我为什么会这样吗,它应该在单击注册时重定向到 database-handler.php。提前致谢。

索引.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <link href="https://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet">
    <link href="style.css" rel="stylesheet">
    <meta charset="UTF-8">
    <title>HappySocial</title>
</head>
<body>
    <center>
    <div class="outer">
        <div class="inner">
    <div id="sign_up">
        <h2>Happy Social</h2>
        <form autocomplete="off" action="database-handler.php" method="POST">
        <input type = "text" id="first_name" placeholder="First Name">
        <br><br>
        <input type = "text" id="last_name" placeholder="Last Name">
        <br><br>
        <input type = "text" id="username" placeholder="Username">
        <br><br>
        <input type = "text" id="password" placeholder="Password">
        </form>
        <br>
        <input type="submit" id="sign_up_button" class="button"></>
    </div>
    <br>
    <div id="sign_in">
    <h3>Already have an account?</h3>
    <button id="sign_in_button" class="button">Sign In</button>
    </div>

</div>
</div>

</body>
</html>

数据库处理程序.php:

<?php

$con = mysqli_connect("localhost", "root","password") or die("Unable to connect");
mysqli_select_db("accounts", $con);

?>

最佳答案

您必须对数据库执行查询才能检索数据。

mysqli_query($con, "SELECT * FROM tableName WHERE user=x AND password=y");

阅读更多:

关于php - 用于登录的后端系统无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51228856/

相关文章:

php - jQuery 自动完成 ui 与 json 问题

javascript - 我应该将 10,000 行加载到 Angular 应用程序的内存中吗?

php - 添加到候选名单 PHP MYSQL 或 JQUERY?

php - Access 数据库并向多用户 Web 界面报告

javascript - 将 javascript 时间函数转换为 php

php - Yii2中的Active Record,连接多个表,查找某个线程的评分,并在ListView中检索评分

mysql - 无法在 phpmyadmin 中添加外键约束

php - Mysql查询语法问题

mysql - 如何使用 MAX() 选择整行?

php - mysql 按天过滤