Column 'fecha' cannot be null
Publicado por sandra (60 intervenciones) el 05/12/2007 23:01:28
Hola, tengo un formulario para insertar registros.
Referencia
descripcion
fecha
foto
me gustaria saber como puedo hacer para que por ejemplo ,sino se mete el campo fecha por lo que sea, me deje insertar todos los demas campos.
Que tendria que poner? para que no sea obligatorio ese campo fecha.
gracias
ah este codigo no se si tendra algo que ver con mi pregunta gracias
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
Referencia
descripcion
fecha
foto
me gustaria saber como puedo hacer para que por ejemplo ,sino se mete el campo fecha por lo que sea, me deje insertar todos los demas campos.
Que tendria que poner? para que no sea obligatorio ese campo fecha.
gracias
ah este codigo no se si tendra algo que ver con mi pregunta gracias
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
Valora esta pregunta


0