Error "Does not have a default value" when trying to insert data in DB [closed]

5

I was trying to insert the variables I received from a form when I received this error message:

  

'nidcrespons1' does not have a default value

My code:

<?php
    $link = mysqli_connect("localhost", "root", "vertrigo", "winit");
    $nomeempresa = $_POST["nomeempresa"];
    $paisempresa = $_POST["paisempresa"];
    $moradaempresa = $_POST["moradaempresa"];
    $nifempresa = $_POST["nifempresa"];
    $crc = $_POST["crc"];
    $telefoneempresa = $_POST["telefoneempresa"];
    $respons1 = $_POST["respons1"];
    $nidcrespons1 = $_POST["nidcrespons1"];
    $nifrespons1 = $_POST["nifrespons1"];
    $emailempresa = $_POST["emailempresa"];
    $senhaempresa = $_POST["senhaempresa"];

    echo $nomeempresa;
    echo $paisempresa;

    $insere = mysqli_query($link, "INSERT INTO empresas (nomeempresa, respons1) VALUES ('$nomeempresa', '$respons1')") or die(mysqli_error($link));
?>
    
asked by anonymous 22.03.2016 / 18:05

1 answer

6
The problem is that you have to pass some value to the columns of the database that are NOT NULL , the column can not be without nothing, that is, INSERT has to have something, to fill the column.

    
22.03.2016 / 18:32