This is the core part of the upload program. After finishing filtering, removing common words and duplicate words,
this function is called. First this function inserts the title and abstract in the content table. The newly generated
content id stored in $contentId. Then it updates keyword and link table.
For every word in the $wordMap array, if the word is already exists in keyword table, it
inserts the key id, content id in to link table. Conversely, if the word is not found, it inserts the new word in keyword
table, the generated new key id is stored in $keyId. Then it updates link table by inserting
key id content id in link table.
// insert into content
mysql_query( sprintf( "INSERT INTO content (title, abstract) VALUES ('%s', '%s')",
mysql_escape_string($title), mysql_escape_string($body) ) );
//store the newly generated content id in $contentId
$contentId = mysql_insert_id();
// insert all the new words and links
while(list($word,$val)=each($wordList)) {
$keyId = "";
if ( !$allWords[$word] ) {
mysql_query( sprintf( "INSERT INTO keytable ( keyword ) VALUES ( '%s' )",
mysql_escape_string($word) ) );