准备声明准备错误[重复]

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>

The reason for the error is that the call to $conn->prepare fails. Seeing that this is a mysqli code - check the error after calling prepare:

$stmt = $conn->prepare($sql);
if ($stmt === false) {
    var_dump($conn->error);
}

Additionally, your call to bind_param doesn't seem right.