Hallo,
Ich habe hier ein Code. Und es kommt immer diese Fehlermeldung.
Was mach ich falsch ? Am Ende hab ich den Code ein bisschen gekürzt, da der Post sost zu lang gewesen wäre. Da war aber nur noch unwichtiges.
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 '-Mail, Passwort, Kartoffelsalat, Reissalat, Nudelsalat, Blattalat, Vorpeise, Gem' at line 1
Vielen Dank
Gruß
Fabi
Ich habe hier ein Code. Und es kommt immer diese Fehlermeldung.
Was mach ich falsch ? Am Ende hab ich den Code ein bisschen gekürzt, da der Post sost zu lang gewesen wäre. Da war aber nur noch unwichtiges.
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 '-Mail, Passwort, Kartoffelsalat, Reissalat, Nudelsalat, Blattalat, Vorpeise, Gem' at line 1
PHP:
<?php require_once('Connections/bette.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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"] == "Form1")) {
$insertSQL = sprintf("INSERT INTO Essensspenden_Salate (Vorname, Nachname, Klasse, Telefonnummer, E-Mail, Passwort, Kartoffelsalat, Reissalat, Nudelsalat, Blattalat, Vorpeise, Gemüse, Sonstiges) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Vorname'], "text"),
GetSQLValueString($_POST['Nachname'], "text"),
GetSQLValueString($_POST['Klasse'], "text"),
GetSQLValueString($_POST['Telefonnummer'], "text"),
GetSQLValueString($_POST['e-mail'], "text"),
GetSQLValueString($_POST['Passwort'], "text"),
GetSQLValueString(isset($_POST['Kartoffelsalat']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Reissalat']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Nudelsalat']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Blattsalat']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Vorspeise']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Gemuse']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['Sonstiges'], "text"));
mysql_select_db($database_bette, $bette);
$Result1 = mysql_query($insertSQL, $bette) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
</head>
<body>
<div class="Tabellentext" id="website">
<div class="farbiger_Text_rot" id="header1">
<table width="980" height="53" border="0">
<tr>
<td width="347"><a href="index.html"><img src="logo.png" width="250" height="47" /></a></td>
<td width="617" class="headertext">Sommerfest 2013</td>
</tr>
</table>
</div>
<div id="header2">
</div>
<ul class="Navialink" id="Navi">
<li><a href="index.php" class="Navialink">Home</a></li>
<li><a href="Anmeldung.php" class="Navialink">Anmeldung</a></li>
<li><a href="Essensspenden.php" class="Navialink">Essensspenden</a></li>
<li><a href="Standdienst.php" class="Navialink">Standdienst</a></li>
<li><a href="Meine_Zusagen.php" class="Navialink">Meine Zusagen</a></li>
<li><a href="Hilfe.php" class="Navialink">Hilfe</a></li>
</ul>
<!-- InstanceBeginEditable name="EditRegion1" -->
<div id="main"><br />
<form action="<?php echo $editFormAction; ?>" method="POST" name="Form1">
<table width="675" height="281" border="0" align="center" style="table-layout:fixed">
<td height="19"><tr>
<td height="52" colspan="3" align="center"><p class="Datenschutz">Mit Ihren Daten wird stets vertraulich umgegangen !!!</p>
<p class="Datenschutz_klein">Nur Vorname, Nachname und Klasse sind öffentlich einsehbar !!!</p>
<p class="Datenschutz_klein"> </p></td>
</tr>
<tr>
<td width="242" align="left">Vorname*</td>
<td width="242" align="left">Nachname*</td>
<td width="180" align="left">Klasse*</td>
</tr>
<tr>
<td align="left">
<label for="Vorname"></label>
<input name="Vorname" type="text" id="Vorname" size="30" />
</td>
<td align="left"><input name="Nachname" type="text" id="Nachname" size="30" /></td>
<td align="left"><input name="Klasse" type="text" id="Klasse" size="10" /></td>
</tr>
<tr>
<td align="left">Telefonnummer* <span class="farbiger_Text_rot" id="sprytrigger3"><strong>?</strong></span></td>
<td align="left">E-mail* <span class="farbiger_Text_rot" id="sprytrigger2"><strong>?</strong></span></td>
<td align="left">Passwort*<span class="farbiger_Text_rot" id="sprytrigger1"><strong> ?</strong></span></td>
</tr>
<tr>
<td align="left"><input name="Telefonnummer" type="text" id="Telefonnummer" tabindex="4" size="30" /></td>
<td align="left"><input name="e-mail" type="text" id="e-mail" tabindex="5" size="30" /></td>
<td align="left"><input name="Passwort" type="password" id="Passwort" tabindex="6" size="30" /></td>
</tr>
<tr>
<td colspan="3" align="left">Bemerkungen</td>
</tr>
<tr>
<td colspan="3" align="left"><textarea name="Bemerkungen" cols="100" style= "width:655px;"rows="3" id="Bemerkungen" tabindex="7"></textarea></td>
</tr>
</table>
<p><br />
</p>
<h1> <table width="826" border="3" align="center">
<tr>
<td width="124" height="26" align="center"><h3>Kartoffelsalat</h3></td>
<td width="85" align="center"><h3>Reissalat</h3></td>
<td width="92" align="center"><h3>Nudelsalat</h3></td>
<td width="97" align="center"><h3>Blattsalat</h3></td>
<td width="86" align="center"><h3>Vorspeise</h3></td>
<td width="78" align="center"><h3>Gemüse</h3></td>
<td width="233" align="center"><h3>Sonstiges</h3></td>
</tr>
<tr>
<td align="center"><h3>
<input type="checkbox" name="Kartoffelsalat" id="Kartoffelsalat" tabindex="6"/>
<label for="Kartoffelsalat"></label>
</h3></td>
<td align="center"><h3>
<input type="checkbox" name="Reissalat" id="Reissalat" />
<label for="Reissalat"></label>
</h3></td>
<td align="center"><h3>
<input type="checkbox" name="Nudelsalat" id="Nudelsalat" />
<label for="Nudelsalat"></label>
</h3></td>
<td align="center"><h3>
<label for="Vorspeise"></label>
<input type="checkbox" name="Blattsalat" id="Blattsalat" />
</h3></td>
<td align="center"><h3>
<label for="Blattsalat"></label>
<input type="checkbox" name="Vorspeise" id="Vorspeise" />
</h3></td>
<td align="center"><h3>
<input type="checkbox" name="Gemuse" id="Gemuse" />
<label for="Gemuse"></label>
</h3></td>
<td align="center"><h3>
<label for="Sonstiges"></label>
<input name="Sonstiges" type="text" id="Sonstiges" size="40" />
</h3></td>
</tr>
</table> </h1>
<p>
<input type="submit" name="Daten absenden" id="Daten absenden" value="Daten absenden" />
</p>
<input type="hidden" name="MM_insert" value="Form1">
</form>
</p>
<p> </p>
</div>
Vielen Dank
Gruß
Fabi
Zuletzt bearbeitet: