0

I send by a form the paramentres to this archive .php

<?php
$mysqli = new mysqli("localhost", "root", "", "bdpersona"); 

    $sql = $mysqli->prepare("insert into tbcontactos (nombre, edad, direccion) values (?, ?, ?) ");
    $sql->bind_param("sis", $nom, $edad, $dir);
    $nom = $_GET['nombre'];
    $edad = $_GET['edad'];
    $dir = $_GET['direccion'];
    $sql->execute();        
?>  

So far, all is okey

I want a add new element "descuento". First, I add the element in the form same the the others and new column in database. Then:

<?php
$mysqli = new mysqli("localhost", "root", "", "bdpersona"); 

    $sql = $mysqli->prepare("insert into tbcontactos (nombre, edad, direccion, descuento) values (?, ?, ?, ?) ");
    $sql->bind_param("sis", $nom, $edad, $dir, $des);
    $nom = $_GET['nombre'];
    $edad = $_GET['edad'];
    $dir = $_GET['direccion'];
    $des = $_GET['descuento'];
    $sql->execute();        
?>  

But I have a error:

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables in C:\xampp\htdocs\fondomarino\insertar.php on line 8

What is the error???

Vidal
  • 195
  • 1
  • 9

0 Answers0