insert fejl ved gemning i MySQL
Jeg får en fejl når jeg forsøger, at gemme nogle oplysninger i databasen. Det lange tal der vises i fejlen er IPadressen den også skal gemme på vedkommende der forsøger at gemme.Hvordan løser jeg dette, således at oplysninger bliver gemt rigtigt i databasen? Fejlen består af følgende:
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 'create, folder) VALUES ('83.17.987.16','1',NOW(),'','','','')'
Der gøres brug af: photo.add.php og photo.config.php
photo.add.php -->
<?php
require('../access/access_config.php');
// Creating option tags with year data
$Res = mysql_query("SELECT id, year FROM photo_year ORDER BY year");
$CategoryOptions = "";
while (list($CategoryId,$CategoryTitle) = mysql_fetch_row($Res))
{
$CategoryOptions .= "<option value=\"$CategoryId\">".stripslashes($CategoryTitle)."</option>\n";
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php include ('../includes/menu.php'); ?>
<form action="photo.config.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="referer" value="photo.add">
<table border="0" width="100%" height="204">
<tr>
<td width="11%" height="25">Overskrift</td>
<td width="1%" height="25">:</td>
<td width="88%" height="25"><input type="text" name="title" size="42"></td>
</tr>
<tr>
<td width="11%" height="81">Beskrivelse</td>
<td width="1%" height="81">:</td>
<td width="88%" height="81"><textarea rows="3" name="description" cols="35"></textarea></td>
</tr>
<tr>
<td width="11%" height="21"> </td>
<td width="1%" height="21"></td>
<td width="88%" height="21"></td>
</tr>
<tr>
<td width="11%" height="25">Årstal</td>
<td width="1%" height="25">:</td>
<td width="88%" height="25"><select name="year"><?php echo $CategoryOptions; ?></select></td>
</tr>
<tr>
<td width="11%" height="21"> </td>
<td width="1%" height="21"></td>
<td width="88%" height="21"></td>
</tr>
<tr>
<td width="11%" height="25">Fotograf/oprettet af</td>
<td width="1%" height="25">:</td>
<td width="88%" height="25"><input type="text" name="create" size="42"></td>
</tr>
<tr>
<td width="11%" height="21"> </td>
<td width="1%" height="21"></td>
<td width="88%" height="21"></td>
</tr>
<tr>
<td width="11%" height="1"></td>
<td width="1%" height="1"></td>
<td width="88%" height="1"><input type="submit" value="Opret fotoalbum" name="B1">
<input type="reset" value="Slet alt" name="B2">
<input type="hidden" name="ip" value="<?php print $_SERVER['REMOTE_ADDR']; ?>"></td>
</tr>
</table>
</form>
</body>
</html>
photo.config.php -->
<?php
include('../access/access_config.php');
if ($_POST['referer'] == 'photo.add') {
mysql_query("INSERT INTO photo_album (ip, year, date, title, description, create, folder) VALUES ('".$_POST['ip']."','".$_POST['year']."',NOW(),'".$_POST['title']."','".$_POST['description']."','".$_POST['create']."','".$_POST['folder']."')") or die(mysql_error());
header("Location: photo.add.php");
}
?>
