Error inserting data into mysql with foreach

0

The following code is used to insert mysql with a foreach

foreach ($puntosVisita as $nombre) {
    echo $nombre;
    mysqli_query($bd, "INSERT INTO puntosVisita (idRuta, nombre, fechaMod) VALUES ('$consecutivo', '$nombre', '$fechaMod')") or die(mysqli_error($bd));
}

only records the first value of the array in the database, the problem is that it saves them with id = 0, how can I solve it ?, attached image of the base fields

    
asked by Jose Luis GP 10.04.2017 в 20:00
source

1 answer

1

Hello, if you are saving the ID of value 0, it is because you have not defined the increased car of your key, you just have to define it with the same phpmyadmin I leave you the Ej:

    
answered by 10.04.2017 / 20:10
source