Location: PHPKode > projects > MyNotebook > mynotebook/notes.edit.php
<?php
  // Updates note in database
  function editNote ()
  {
	global $db_tagTableName;
	global $db_tableName;
	global $db_noteTagsTableName;
	
	global $note;
	global $tags;
	global $id;
	global $selectedTags;
	
	$note = stripslashes($note);
	
	CheckIfIsEmptyTag ($tags);

	UpdateNoteTags ($note, $tags, $id);
	$result = mysql_query ("UPDATE $db_tableName set note='$note' WHERE id='$id'");
	$result = mysql_query ("SELECT datetime FROM $db_tableName WHERE id='$id'");
	$row = mysql_fetch_array ($result);
	$dateTime = $row["datetime"];

	if ($result)
	{
		$newNote = new Note ($id, $note, $note, $tags, $dateTime);

		$jsonArray = array();
		$jsonArray[0]["tagLinks"] = getTagLinks();
		$jsonArray[1]["id"] = $newNote->getId();
		$jsonArray[1]["note"] = $newNote->getNote();
		$jsonArray[1]["tags"] = $newNote->getTags();
		$jsonArray[1]["date"] = $newNote->getDate();
		$jsonArray[1]["innerHTML"] = $newNote->getInnerHTML();
		$json = new Services_JSON();
		echo $json->encode($jsonArray);
		exit;
	}
	else
	{
      $jsonResponse->addValue ("errorText", mysql_error());
    }
    echo $jsonResponse->createJSONString ();    
    
    exit;
  }
?>
Return current item: MyNotebook