Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/11/2006, 15:01
Avatar de rogertm
rogertm
Mod->Cuba
 
Fecha de Ingreso: julio-2005
Ubicación: /home/Cuba/Habana/rogertm/
Mensajes: 2.922
Antigüedad: 19 años, 7 meses
Puntos: 638
Exclamación error que no entiendo, que es? Duplicate entry '0' for key 1....¿?

hola a todos los aqui presentes, tengo una pagina a la cual llamo por un include, de esta manera:
Código PHP:
<a href="index.php?id=firmar">Firmar libro</a>
<?php 
    $id 
$_GET['id'];
    switch (
$id) {
    case 
"firmar": include('firmar.php');
    break;
    } 
    
?>
script que encontre en este mismo foro, y me devuelve este error que mensiono en el titulo de mi post:

Duplicate entry '0' for key 1

la pagina firmar.php, tiene un formulario en la que el usuario plasmara su firma en un libro de visitas, bla, bla, bla.....
pero que siempre da el mismo error y ni siquiera introduce los datos en la tabla correspondiente............¿?
como dato adicional: estoy usando dreamweaver 8 y he hecho el query tal y como lo hago siempre con los demas formularios del sitio que estoy haciendo, ya probe poner el formulario en la misma pagina, sin el include, y nada.....
aqui les doy el codigo hecho por dreamweaver:

Código PHP:
<?php
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;
}

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

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "firmar_libro")) {
  
$insertSQL sprintf("INSERT INTO libro_visitas (nombre, email, url, firma, fecha, `date`) VALUES (%s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['url'], "text"),
                       
GetSQLValueString($_POST['firma'], "text"),
                       
GetSQLValueString($_POST['fecha'], "text"),
                       
GetSQLValueString($_POST['date'], "date"));

  
mysql_select_db($database_palacio_db_conect$palacio_db_conect);
  
$Result1 mysql_query($insertSQL$palacio_db_conect) or die(mysql_error());

  
$insertGoTo "index.php?id=firmar#firmar";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
todo esto esta en la pagina firmar.php, tambien lo probe en la pagina desde la cual hago el llamado, y siempre lo mismo.

espero como siempre resivir la ayuda de ustedes.
gracias.
__________________
Friki y Blogger por Cuenta Propia:213
Twenty'em: Theming is Prose