Number of variables. Error

0

I can not find the error, to see if someone tells me that I am doing wrong. I added the registry but it gives me an error before.

Warning: mysqli_stmt_bind_param (): Number of variables does not match number of parameters in prepared statement in /results_insertar_registers.php on line 32.

$seccion = $_GET['SECCIÓN'];
$nombreart = $_GET['NOMBREARTĪCULO'];
$fechas = $_GET['FECHA'];
$pais = $_GET['PAÍSDEORIGEN'];
$precio = $_GET['PRECIO'];


require("conexion.php");

$sql="INSERT INTO ARTÍCULOS (SECCIÓN,NOMBREARTÍCULO,FECHA,PAÍSDEORIGEN,PRECIO) VALUES ('$seccion', '$nombreart', '$fechas','$pais', '$precio')";

$resultado = mysqli_prepare($conexion, $sql);
$ok = mysqli_stmt_bind_param($resultado, "sssss", $seccion, $nombreart, $fechas, $pais, $precio ); 

$ok = mysqli_stmt_execute($resultado);

if($ok == false) {
    echo "Error al ejecutar la consulta";
} else {
    echo "Registro agregado <br><br>";
}

mysqli_stmt_close ($resultado);
    
asked by NicoWebs 02.01.2019 в 04:16
source

1 answer

0

in this part

$sql="INSERT INTO ARTÍCULOS (SECCIÓN,NOMBREARTÍCULO,FECHA,PAÍSDEORIGEN,PRECIO) VALUES ('$seccion', '$nombreart', '$fechas','$pais', '$precio')";

Does not it go like that?

$sql='INSERT INTO ARTÍCULOS (SECCIÓN,NOMBREARTÍCULO,FECHA,PAÍSDEORIGEN,PRECIO) VALUES (?,?, ?,?,?)';

You are directly passing the variables to them and then you are adding them again

$ok = mysqli_stmt_bind_param($resultado, "sssss", $seccion, $nombreart, $fechas, $pais, $precio ); 
    
answered by 02.01.2019 в 05:28