while ($audience = mysql_fetch_assoc($que_audience)) {
        $id_interest = $audience['id_interest'];
        $name = $interests[$id_interest]['name'];
        $nivel = $interests[$id_interest]['nivel'];
        $nivel_superior = !empty($interests[$id_interest]['nivel_superior']) ? $interests[$id_interest]['nivel_superior'] : 0;
        $total_user = $audience['total_user'];
        $total_female = $audience['total_female'];
        $total_male = $audience['total_male'];
        $grow_1 = getCrecimiento($country['id_country'], $id_interest, $country_interests_last_update, 1);
        $grow_3 = getCrecimiento($country['id_country'], $id_interest, $country_interests_last_update, 3);
        $grow_7 = getCrecimiento($country['id_country'], $id_interest, $country_interests_last_update, 7);
        $grow_15 = getCrecimiento($country['id_country'], $id_interest, $country_interests_last_update, 15);
        $grow_30 = getCrecimiento($country['id_country'], $id_interest, $country_interests_last_update, 30);
        $chart_history = '';
        if ($nivel == 1) {
            $chart_history = get_an_column_history($id_interest, $country['id_country'], $country_interests_last_update, 30);
            $chart_history = json_encode($chart_history);
        }
        $query = 'SELECT id_interest, country_code FROM ' . DB_RESULTS_PREFIX . 'facebook_countries_interests WHERE country_code = \'$10\' AND id_interest = $11;';
        $que_interest = db_query_table_results($query, array($country_code, $id_interest));
        if ($row = mysql_fetch_assoc($que_interest)) {
            $query = "UPDATE " . DB_RESULTS_PREFIX . "facebook_countries_interests SET \n                                                    name = '\$10',\n                                                    nivel = \$11,\n                                                    nivel_superior = \$12,\n                                                    total_user = \$13,\n                                                    total_female = \$14,\n                                                    total_male = \$15,\n                                                    grow_1 = \$16,\n                                                    grow_3 = \$17,\n                                                    grow_7 = \$18,\n                                                    grow_15 = \$19,\n                                                    grow_30 = \$20,\n                                                    chart_history = '\$21',\n                                                    updated_at = NOW()\n                                                    \n                                                    WHERE country_code = '\$22' AND id_interest = \$23;";
            $values = array($name, $nivel, $nivel_superior, $total_user, $total_female, $total_male, $grow_1, $grow_3, $grow_7, $grow_15, $grow_30, $chart_history, $country_code, $id_interest);
            $res = db_query_table_results($query, $values, 1);
        } else {
            $query = "INSERT INTO " . DB_RESULTS_PREFIX . "facebook_countries_interests VALUES(NULL, \$10, '\$11', \$12, \$13, '\$14', \$15, \$16, \$17, \$18, \$19, \$20, \$21, \$22, '\$23', NOW());";
            $values = array($id_interest, $name, $nivel, $nivel_superior, $country_code, $total_user, $total_female, $total_male, $grow_1, $grow_3, $grow_7, $grow_15, $grow_30, $chart_history);
            $res = db_query_table_results($query, $values, 1);
        }
    }
}
        $name = $comportamientos[$id_comportamiento]['name'];
        $nivel = $comportamientos[$id_comportamiento]['nivel'];
        $nivel_superior = !empty($comportamientos[$id_comportamiento]['nivel_superior']) ? $comportamientos[$id_comportamiento]['nivel_superior'] : 0;
        $mobile_device = $comportamientos[$id_comportamiento]['mobile_device'];
        $mobile_os = $comportamientos[$id_comportamiento]['mobile_os'];
        $total_user = $audience['total_user'];
        $total_female = $audience['total_female'];
        $total_male = $audience['total_male'];
        $grow_1 = getCrecimiento($country['id_country'], $id_comportamiento, $country_comportamientos_last_update, 1);
        $grow_3 = getCrecimiento($country['id_country'], $id_comportamiento, $country_comportamientos_last_update, 3);
        $grow_7 = getCrecimiento($country['id_country'], $id_comportamiento, $country_comportamientos_last_update, 7);
        $grow_15 = getCrecimiento($country['id_country'], $id_comportamiento, $country_comportamientos_last_update, 15);
        $grow_30 = getCrecimiento($country['id_country'], $id_comportamiento, $country_comportamientos_last_update, 30);
        $chart_history = '';
        if ($id_comportamiento == 92 || $id_comportamiento == 93 || $id_comportamiento == 94 || $comportamientos[$id_comportamiento]['nivel'] == 3 && mobile_device_has_more_device($id_comportamiento)) {
            $chart_history = get_an_column_history($id_comportamiento, $country['id_country'], $country_comportamientos_last_update, 30);
            $chart_history = json_encode($chart_history);
        }
        $query = 'SELECT id_comportamiento, country_code FROM ' . DB_RESULTS_PREFIX . 'facebook_countries_comportamientos WHERE country_code = \'$10\' AND id_comportamiento = $11;';
        $que_comportamiento = db_query_table_results($query, array($country_code, $id_comportamiento));
        if ($row = mysql_fetch_assoc($que_comportamiento)) {
            $query = "UPDATE " . DB_RESULTS_PREFIX . "facebook_countries_comportamientos SET \n                                                    name = '\$10',\n                                                    nivel = \$11,\n                                                    nivel_superior = \$12,\n                                                    mobile_device = \$13,\n                                                    mobile_os = '\$14',\n                                                    total_user = \$15,\n                                                    total_female = \$16,\n                                                    total_male = \$17,\n                                                    grow_1 = \$18,\n                                                    grow_3 = \$19,\n                                                    grow_7 = \$20,\n                                                    grow_15 = \$21,\n                                                    grow_30 = \$22,\n                                                    chart_history = '\$23',\n                                                    updated_at = NOW()\n                                                    \n                                                    WHERE country_code = '\$24' AND id_comportamiento = \$25;";
            $values = array($name, $nivel, $nivel_superior, $mobile_device, $mobile_os, $total_user, $total_female, $total_male, $grow_1, $grow_3, $grow_7, $grow_15, $grow_30, $chart_history, $country_code, $id_comportamiento);
            $res = db_query_table_results($query, $values, 1);
        } else {
            $query = "INSERT INTO " . DB_RESULTS_PREFIX . "facebook_countries_comportamientos VALUES(NULL, \$10, '\$11', \$12, \$13, \$14, '\$15', '\$16', \$17, \$18, \$19, \$20, \$21, \$22, \$23, \$24, '\$25', NOW());";
            $values = array($id_comportamiento, $name, $nivel, $nivel_superior, $mobile_device, $mobile_os, $country_code, $total_user, $total_female, $total_male, $grow_1, $grow_3, $grow_7, $grow_15, $grow_30, $chart_history);
            $res = db_query_table_results($query, $values, 1);
        }
    }
}