PHP / MYSQL - 插入行但不插入数据

时间:2015-08-30 00:20:09

标签: php mysql

我有一个非常奇怪的问题。我在我的注册页面添加了列,现在当我们注册时(插入命令),它为该行腾出了空间,但不包括细节。

我认为添加列是一个问题,但如果有人知道我在说什么,我很好奇吗? (添加了我的代码......没有什么超级刺激的)

<?php
    if($_POST){
    $link   = mysqli_connect("******","*****","","******") or die("Error " . mysqli_error($link)); 

    $username       =   $_POST['username'];
    $password       =   $_POST['password'];
    $firstname      =   $_POST['firstname'];
    $lastname       =   $_POST['lastname'];
    $birthday       =   $_POST['birthday'];
    $zipcode        =   $_POST['zipcode'];
    $gender         =   $_POST['gender'];

    $query  =   "INSERT into users (username, password, firstname, lastname, birthday, zipcode, gender) VALUES ('$username','$password','$firstname','$lastname','$birthday','$zipcode','$gender')";
    mysqli_query($link, $query);
    if(!$query)

    mysqli_close($link);
    }   
?>


<html xmls="http://www.w3.org/1999/xhtml">
<head>
<title>Knitworth</title>
<body>

    <style type="text/css">

        #header{
            background-color: green;
                }
        #col1{
            background-color: lightgrey;
            width: 19%;
            float: left;
            display: inline;
                }
        #col2{
            background-color: white;
            width: 58%;
            float: left;
            margin-left: 2%;
                }
        #col3{
            background-color: lightgrey;
            width: 19%;
            float: left;
            margin-left: 1%;
                }
        #footer{
            background-color: green;
            clear: left;
                }
    </style>
</head>

<body>

<div id="header"><br>Register Now!<br><br></div>

<div id="col1">
                <ul>
                <li><a href="login.php">Back to Login</a></li>

                </ul>
</div>
<div id="col2"><br><br><center>Register Now!<center><br><br><br>
<form action="login.php" method="post"><br><br>
        Username:<input type="text" name="username"><br/><br/>
        Password:<input type="text" name="password"><br/><br/>
        First Name:<input type="text" name="firstname"><br/><br/>
        Last Name<input type="text" name="lastname"><br/><br/>
        Birthday<input type="text" name="birthday"><br/><br/>
        Zip Code<input type="text" name="zipcode"><br/><br/>
        Gender<input type="text" name="gender"><br/><br/>
        <input type="submit" value="Register Now!"/>

</form></div>
<div id="col3">.</div>

<div id="footer">footer</div>

</body>
</head>
<html>

0 个答案:

没有答案