This is my first post here, I've been following the forum for a long time but I never wanted to interact, today this will came along with a little problem ...
To learn html, css, php
and etc ... from tutorials, after countless failures I just manage to accomplish what I want. I have the habit of watching several tutorials about the same time and after watching everyone decide which one to use, based on the divergence of information between them and in my intuition. Until it works, but something always happens wrong and then I start looking for content to solve. One of the problems that haunts me is that I do not know how to quote the mistake that has happened, like this one that is happening now. So I think here would be the best option.
The problem: '
<?php </br>
session_start();</br>
$_SESSION['message'] = '';
$mysqli = new mysqli('localhost','root','','accounts'); </br>
if ($_SERVER['REQUEST_METHOD'] == 'POST') { <br>
if ($_POST['password'] == $_POST['confirmpassword']){ <br>
$username = $mysqli->real_escape_string($_POST['username']); <br>
$email = $mysqli->real_escape_string($_POST['email']); <br>
$password = md5($_POST['password']);
$sql = "INSERT INTO users (username, email, password) "
. "VALUES ('$username', '$email', '$password')";
//if the query
if ($mysqli->query($sql) === true) {
$_SESSION['message'] = "deu certo";
header("location: welcome.php");
}
else {
$_SESSION['message'] = "Usuario nao pode ser add";
}
}
}
?>
Difficulty understanding this code tag, my god.
ThisisthetableIcreated:butwhenIgotocheckthedbitonlyhasthis:
This is my first question, if I did something wrong please tell me. Thanks!