MistressVivi
10-16-2004, 08:46 PM
Posting this here, because I'm not seeing a forum for it elsewhere ^^;
I'm trying to make a form that will allow people to fill things out on it and it will post to my website. I've been working on this for a few weeks, and managed to get a simplified version working. The problem is, now that I'm working on the actual one, I get an error that says ERROR
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 'update (date, title, author, update) VALUES ('Saturday, October
screenshot of the database (http://img.photobucket.com/albums/v321/melfra/database.jpg)
and here's the script, also
<?php
include("connect.php");
if(!empty($title)) {
$date = addslashes($date);
$title = addslashes($title);
$author = addslashes($author);
$update = addslashes($update);
$sql = "INSERT INTO update (id, date, title, author, update) VALUES ('NULL','$date','$title','$author','$update')";
$query = mysql_query($sql) or die("ERROR<br>" . mysql_error());
echo "Database Updated.";
} else {
?>
<form name="update" method="post" action="<?php echo $PHP_SELF; ?>">
<p>Updating, huh? Yar!</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="117"><font size="1">Date: </font> </td>
<td width="577">
<font size="1">
<input type="text" name="date" size="50">
</font>
</td>
</tr>
<tr>
<tr>
<td width="117"><font size="1">Title: </font> </td>
<td width="577">
<font size="1">
<input type="text" name="title" size="50">
</font>
</td>
</tr>
<tr>
<tr>
<td width="117"><font size="1">Author:</font></td>
<td width="577">
<font size="1">
<input type="text" name="author" size="50">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Update:</font></td>
<td width="577">
<font size="1">
<textarea name="update" size="50"></textarea>
</font>
</td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Submit"></font>
</p>
</form> <?php
}
?>
so, does anyone know what the heck I'm doing wrong with this?
I'm trying to make a form that will allow people to fill things out on it and it will post to my website. I've been working on this for a few weeks, and managed to get a simplified version working. The problem is, now that I'm working on the actual one, I get an error that says ERROR
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 'update (date, title, author, update) VALUES ('Saturday, October
screenshot of the database (http://img.photobucket.com/albums/v321/melfra/database.jpg)
and here's the script, also
<?php
include("connect.php");
if(!empty($title)) {
$date = addslashes($date);
$title = addslashes($title);
$author = addslashes($author);
$update = addslashes($update);
$sql = "INSERT INTO update (id, date, title, author, update) VALUES ('NULL','$date','$title','$author','$update')";
$query = mysql_query($sql) or die("ERROR<br>" . mysql_error());
echo "Database Updated.";
} else {
?>
<form name="update" method="post" action="<?php echo $PHP_SELF; ?>">
<p>Updating, huh? Yar!</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="117"><font size="1">Date: </font> </td>
<td width="577">
<font size="1">
<input type="text" name="date" size="50">
</font>
</td>
</tr>
<tr>
<tr>
<td width="117"><font size="1">Title: </font> </td>
<td width="577">
<font size="1">
<input type="text" name="title" size="50">
</font>
</td>
</tr>
<tr>
<tr>
<td width="117"><font size="1">Author:</font></td>
<td width="577">
<font size="1">
<input type="text" name="author" size="50">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Update:</font></td>
<td width="577">
<font size="1">
<textarea name="update" size="50"></textarea>
</font>
</td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Submit"></font>
</p>
</form> <?php
}
?>
so, does anyone know what the heck I'm doing wrong with this?