Código PHP:
<a href="index.php?id=firmar">Firmar libro</a>
<?php
$id = $_GET['id'];
switch ($id) {
case "firmar": include('firmar.php');
break;
}
?>
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));
}
?>

espero como siempre resivir la ayuda de ustedes.
gracias.