The database query that creates the table is missing the curly brackets that allow Drupal to add the table prefix.
$result = db_query("CREATE TABLE {favorite_nodes} (