I wrote a code that protects me from sql injections, but now it doesn't even create users. Here is the my code:
<?php
$user = $_GET['username'];
$pass = $_GET['password'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test123";
$conn = new mysqli($servername, $username, $password, $dbname);
function selectInfo($user, $pass){
global $conn;
$stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
$stmt->bind_param("ss", $user, $pass);
$stmt->execute();
$stmt->close();
}
?>
i get no error when executing but it doesn't create users that i need. Sorry for bad code. Im new at this.
globalif you can avoid it.