';
/**
* now enter the above array of word and corresponding count values into the database table
* in case the keyword already exist in the table then update the database table using the function 'update_database_entry(...)'
*/
$table = "tagcloud_db";
mysql_select_db($table, $connection);
foreach ($words as $keyword => $weight) {
$query = "INSERT INTO `tagcloud_db`.`tags` (keyword,weight,link) values ('" . $keyword . "'," . $weight . ",'NA')";
if (!mysql_query($query, $connection)) {
if (mysql_errno($connection) == 1062) {
update_database_entry($connection, $table, $keyword, $weight);
}
}
}
mysql_close($connection);
?>