Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 创建注册表_Mysql_Forms_Isset_Is Empty - Fatal编程技术网

Mysql 创建注册表

Mysql 创建注册表,mysql,forms,isset,is-empty,Mysql,Forms,Isset,Is Empty,(当我在表单中插入用户、电子邮件和密码时,我遇到了一些问题。它没有添加到数据库中。我希望我添加到该注册表中的值显示在php数据库中。我的管理员有我的代码。我不知道这是怎么回事。) require "connect.php"; echo "<br>"; if(!empty($_POST)) { if(isset($_POST['user'],$_POST['email'],$_POST['pass'])) { $user=mysql_real_esca

(当我在表单中插入用户、电子邮件和密码时,我遇到了一些问题。它没有添加到数据库中。我希望我添加到该注册表中的值显示在php数据库中。我的管理员有我的代码。我不知道这是怎么回事。)

require "connect.php";
echo "<br>";

if(!empty($_POST))
{
    if(isset($_POST['user'],$_POST['email'],$_POST['pass']))
    {
        $user=mysql_real_escape_string($_POST['user']);
        $email=mysql_real_escape_string($_POST['email']);
         $pass=md5(mysql_real_escape_string($_POST['pass']));
             if(!empty($user)&&!empty($email)&&!empty($pass))
        {


          $sql=mysql_query("INSERT INTO user(username,email,password) VALUES('$user','$email','$pass')");
                }
            }
          }
          ?>
<html>
<head><title>sign up</title></head>
<body>
    <form method="post">
        <table>
            <tr>
                <td><input type="text" name="user" placeholder="username">Username</td><br><br>

            </tr>
            <tr>
                <td><input type="text" name="email" placeholder="E_mail">email</td><br><br>

            </tr>
            <tr>
                <td><input type="password" name="pass" placeholder="password">password</td><br><br>

            </tr>
            <tr>
                <td><input type="submit" name="sub" value="sign up"></td>

            </tr>
        </table>
    </form>
</body>
</html>
需要“connect.php”;
回声“
”; 如果(!空($\u POST)) { 如果(isset($发布['user'],$发布['email'],$发布['pass'])) { $user=mysql\u real\u escape\u字符串($\u POST['user']); $email=mysql\u real\u escape\u字符串($\u POST['email']); $pass=md5(mysql\u real\u escape\u字符串($\u POST['pass']); 如果(!empty($user)&&!empty($email)&&!empty($pass)) { $sql=mysql_查询(“插入到用户(用户名、电子邮件、密码)值(“$user”、“$email”、“$pass”)”); } } } ?> 注册 用户名

电子邮件

密码

我的connect.php页面

<?php
$connect=new mysqli ('localhost','eman','password','registration');
if($connect->connect_errno)
{
    die("connect error :".$connect->connect_errno);
}
else
{
    echo "connected successfully";
}

您的
connect.php
正在定义一个mysqli连接
$connect
,该连接在另一个页面中从未使用过。此外,您在另一个页面上使用的是
mysql.*
函数,而不是人们希望与
$connect

一起使用的
mysqli.*
函数php并检查表名、字段名和数据类型(数据类型的长度)。我编辑了上面的帖子,如果我遗漏了什么,请告诉我