i have this code:
<?php
if (isset($_POST['agregar-admin'])) {
$nombre = $_POST['nombre'];
$usuario = $_POST['usuario'];
$password = $_POST['contraseña'];
$opciones = array(
'cost' => 12
);
$password_hashed = password_hash($password, PASSWORD_BCRYPT, $opciones);
try {
include_once 'funciones/funciones.php';
$stmt = $conn->prepare("INSERT INTO admins (nombre, usuario, password) VALUES (?, ?, ?)");
$stmt->bind_param("sss", $nombre, $usuario, $password_hashed);
$stmt->execute();
$stmt->close();
$conn->close();
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
}
I'm trying to insert into db from a form, but i get this error:
Fatal error: Call to a member function bind_param() on boolean in C:\wamp64\www\gdlwebcamp\admin\insertar-admin.php on line 17
I have investigated and it is because prepare return false (i think so), tried changing thinks and trying one by one but doesn't work, how can i fix it? Thanks.