Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/06/2009, 04:47
Avatar de speedkill
speedkill
 
Fecha de Ingreso: mayo-2009
Ubicación: Graz
Mensajes: 30
Antigüedad: 14 años, 11 meses
Puntos: 1
Respuesta: Column `name`cannot be null

ahi va...

Código PHP:
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "insertrecord")) {
  
$insertSQL sprintf("INSERT INTO tablamaestro (POS, `CODIGO INCIDENCIA`) VALUES (%s, %s)",
                       
GetSQLValueString($_POST['pos'], "text"),
                       
GetSQLValueString($_POST['codigo inci'], "text"));

  
mysql_select_db($database_conexion$conexion);
  
$Result1 mysql_query($insertSQL$conexion) or die(mysql_error());

  
$insertGoTo "maestro.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

mysql_select_db($database_conexion$conexion);
$query_Recordset1 "SELECT `CODIGO INCIDENCIA` FROM tablamaestro";
$Recordset1 mysql_query($query_Recordset1$conexion) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "httx://xxx.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="httx://xxxx.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nueva Incidencia</title>
</head>

<body>
<form id="insertrecord" name="insertrecord" method="POST" action="<?php echo $editFormAction?>">
  <p>POS 
    <label><input name="pos" type="text" id="pos" size="50" /></label>
</p>
  <p>Codigo Incidencia 
    <label>
    <input name="codigo incidencia" type="text" id="codigo incidencia" size="15" />
    </label>
  </p>
  <p>
    <input type="submit" name="button" id="button" value="Enviar" />
  </p>
  <input type="hidden" name="MM_insert" value="insertrecord" />
</form>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>