Cordial greeting. I have the following, I am trying to insert in two different tables, in a very "simple" way, certain data. In the tables logistica_equipos_calibracion
I have a field called id
that works as an "index", since it is the same name of the station of the table logistica_equipos
, the problem is that when I'm going to perform the insertion says that the id field can not be null.
if((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO logistica_equipos (id, CB) VALUES (%s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['CB'], "text"));
$insertSQL2 = sprintf("INSERT INTO logistica_equipos_calibracion (id_cali, id, CB, MEDIDA1, MEDIDA2) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['id_cali'], "int"),
GetSQLValueString($_POST['id2'], "int"),
GetSQLValueString($_POST['CB'], "text"),
GetSQLValueString($_POST['MEDIDA1'], "text"),
GetSQLValueString($_POST['MEDIDA2'], "text"));
mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error());
$Result2 = mysql_query($insertSQL2, $conexion) or die(mysql_error());
}
<input type="hidden" name="id2" id="id" value="id">
<input type="hidden" name="id" id="id">
<input type="hidden" name="MM_insert" value="form1">