5
I was trying to enter the variables I received from a form when I received this error message:
'nidcrespons1' doesn’t 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));
?>
Pass a value p it, must come from the form, do this for all columns.
– rray
The problem is this same, puts it as an answer for me to give score.
– Gonçalo
You can create an answer :)
– rray
It’s not about the question, but here’s the tip: Prepared statements in your SQL code.
– bfavaretto