You have a typo here:
note_id = ' . $note_id;
' AND user_id = ' . $user_id;
The semi-colon should be a concatenating period:
note_id = ' . $note_id .
' AND user_id = ' . $user_id;
That is not the cause of the SQL error, though. Most likely, $note_id is not set in the $_POST and is getting initialized to an empty string, which will cause an error in the SQL. If $note_id is supposed to be a string, you need to enclose it in quotes like you've done for title, note_text, etc:
note_id = "' . $note_id . '" AND user_id = ' . $user_id;
If it is supposed to be an integer, you can initialize it to 0 or something up top ... but most likely, you should re-evaluate your logic on how you want to proceed if $_POST['note_id'] is not set:
if($note_id != '') {
//do my code
} else {
//do some error handling
}
More clarification for @Majix
Line 2 of your code says this:
$note_id=(isset($_POST['note_id'])) ? $_POST['note_id'] : '';
What this means is "Set $note_id equal to what came through the form's POST in the 'note_id' field, BUT if nothing came through that field, set $note_id to an empty (or blank) string." When you get to the SQL portion of your code, if that $note_id variable is an empty string, then your SQL will read (shortened for clarity):
UPDATE nbk_notes SET title = 'Some Title', note_text = 'Text' WHERE note_id =
See how there's nothing after the =? SQL throws an error because this makes no sense. note_id = what? If note_id is supposed to be a string and not a number, and you really wanted to find something with an empty note_id, you might want your SQL to say:
UPDATE nbk_notes SET title = 'Some Title', note_text = 'Text' WHERE note_id = ''
Here it knows you're checking to see if note_id equals an empty string. However, it's very likely that note_id is supposed to be an integer, and the problem with your code is that you SHOULD have a number in that 'note_id' field, but for whatever reason, you don't. What you want the SQL to say is something like this (5 is just an example):
UPDATE nbk_notes SET title = 'Some Title', note_text = 'Text' WHERE note_id = 5
But $note_id isn't a number for you. Either 'note_id' is being submitted through the form as an empty string, OR it's not being submitted through the form at all and is being set to an empty string in the aforementioned Line 2. Perhaps you could post the code that generates the itself so we know why note_id is not coming through properly?
All this being said, I'm aware that you're a beginner and just want to get this code working, but you should read the links @esqew posted in the first comment and migrate away from mysql_* functions.