This question already has an answer here:
insert-admin.php
<?php
$usuario = $_POST['usuario'] ;
$nombre = $_POST['nombre'] ;
$contraseña = $_POST['contraseña'];
$opciones = array( 'cost' => 12 );
$contraseña_hash = password_hash($contraseña, PASSWORD_BCRYPT, $opciones);
try {
include_once 'funciones/funciones.php';
$sql = "INSERT INTO admins (usuario, nombre, contraseña) VALUES (?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $usuario, $nombre, $contraseña);
$stmt->execute();
$stmt->close();
$conn->close();
} catch (Exception $e) {
echo "error: " . $e->getMessage();
}
The include_once file:
<?php
$conn = new mysqli('localhost', 'root', '', 'gdlwebcamp');
if ($conn->connect_error) {
echo $error-> $conn->connect_error;
}
the query can not be executed because the bind_param receives a false.
Error: Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in C:\xampp\htdocs\conferencias\dashboard\insertar-admin.php:14 Stack trace: #0 {main} thrown in C:\xampp\htdocs\conferencias\dashboard\insertar-admin.php on line 14
</div>