Ciao ragazzi,
sto tentando di modificare una newsletter scaricata da internet e nella modifica dei dati si è creato un errore su MySQL:
Errore
query SQL:
`nome``cognome``ente``email` SELECT COUNT( * ) AS `Righe` , `id`
FROM `iscritti`
GROUP BY `id`
ORDER BY `id`
LIMIT 0 , 30
Messaggio di MySQL:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nome``cognome``ente``email` SELECT COUNT( * ) AS `Righe` , `id`
inoltre quando il form di sottoscrizione della news letter va ad effettuare l'iscrizione mi da come risultato questo messaggio:
Column count doesn't match value count at row 1
vi posto pure il codice così avete un quadro completo della situazione:
codice:
<?php require_once('newsletterconn.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"] == "modulo")) {
$insertSQL = sprintf("INSERT INTO iscritti (nome, cognme, ente, email) VALUES (%s)",
GetSQLValueString($_POST['nome, cognme, ente, email'], "text"));
mysql_select_db($database_newsletterconn, $newsletterconn);
$Result1 = mysql_query($insertSQL, $newsletterconn) or die(mysql_error());
$insertGoTo = "grazie.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="stile.css" />
<title>AGWS Newsletter</title>
</head>
<body>
<div align="center" class="bianco"> </div>
<div align="center" id="testata">Iscriviti alla newsletter</div>
<div align="center" id="contenuto">
<form method="POST" action="<?php echo $editFormAction; ?>" name="modulo">
Nome:
<input name="nome" type="text" size="50" />
Cognome:
<input name="cognome" type="text" size="50" />
Ente appartenenza:
<input name="ente" type="text" size="50" />
E-mail:
<input name="email" type="text" size="50" />
<input type="submit" value="Invia" />
<input type="hidden" name="MM_insert" value="modulo">
</form>
</div>
<div align="center" class="bianco"> <a href="admin/index.php">Amministrazione
newsletter >></a></div>
<div align="center" id="footer"> Sistema di gestione newsletter by <a href="http://www.agwebsolutions.it" title="Vuoi una newsletter così per il tuo sito?">AG
web solutions</a></div>
</body>
</html>
sapete dirmi cosa è successo?
Grazie