This script is just for taking notes. . .pretty simple. . .but I'm getting this weird error:
MySQL 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 ' )' at line 2
The codes I'm running are these:
This one is part of the class Note
function newNote() {
$this->noteTitle = $_POST['title'];
$this->noteText = $_POST['text'];
mysql_query("INSERT INTO notes ( noteID, noteTitle, noteText )
VALUES ( '', {$this->noteTitle}, {$this->noteText} )") or die("MySQL Error:".mysql_error());
}
And the form etc.
<?php
if($id == "new") {
?>
<p><form method="post" action="?id=new">
<input type="text" name="title" value="Note Title" /><br />
<textarea name="text">Note Text</textarea>
<input type="submit" value="Add Note" />
</form></p>
<?php
if($_POST) {
$note->newNote();
echo("Note added! View <a href=\"?id=view\">here</a>");
}
}
What's wrong??? It doesn't show up when I submit, just when the script loads. . .help!