0

I have a project and in this project, I mast to use the registers. I try to write many user registers but isn't show in the databases. I don't know what is the problem. Please, can you help me?

This is one of them:

form.php

<?php
session_start();
$_SESSION['massage'] = " ";
?>

<html>
<head>
</head>
<body>
<div class="module">

<fieldset>
<legend>Create an account:</legend>

<form class="flp" mathod ="POST" action="Register.php" enctype="multipart/form-data">

<div>
<input type="text" placeholder="User Name" name="username" required />
</div>

<div>
<input type="email" placeholder="Email" name="email" required />
</div>

<div>
<input type="password" placeholder="Password" name="password" required />
</div>

<div>
<input type="password" placeholder="Confrim Password" name="confrimpassword" required />
</div>

<center>
    <input type="submit" name="Register" value="Go"/>

</center>
<div>
 <?php echo $_SESSION['massage']; ?>
</div>
</fomr>
</fieldset>
</div>

</body>
</html>

Register.php

<?php
session_start();
$_SESSION['massage'] = " ";
//connect to database
$mysqli = new mysqli("localhost", "root", "", "accounts");

if (isset($_POST['Register'])){//to check the button

$username = mysql_real_escape_string($_POST['username']);
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
$password2 = mysql_real_escape_string($_POST['confrimpassword']);

if($password == $password2){
//Create User
$password = md5($_POST['password']);//hash password before storing for security purposes
$sql = "INSERT INTO account (UserName, Email, PassWord) VALUES ('$username', '$email', '$password')";
mysql_query($mysqli, $sql);
    }
else
        {
$_SESSION['massage'] = "There error!";
        }
mysql_close($mysqli);
}
?>
  • **Stop** using deprected `mysql_*` API. use `mysqli_` or `PDO` – Jens Apr 05 '17 at 08:52
  • 1
    You are mixing the old `mysql_...()` and the current `mysqli_...()` functions. That is not possible. – arkascha Apr 05 '17 at 08:53
  • `PassWord` is a reserved word in mysql. Change the column Name or put backticks arround – Jens Apr 05 '17 at 08:53
  • Take a look into your http servers error log file. That will constantly help you to find such issues yourself. – arkascha Apr 05 '17 at 08:53
  • Possible duplicate of [What is the difference between MySQL, MySQLi and PDO?](http://stackoverflow.com/questions/2190737/what-is-the-difference-between-mysql-mysqli-and-pdo) – gmc Apr 05 '17 at 10:04

0 Answers0