Ejemplo n.º 1
0
function add_fb_page_sub_category($sub_category)
{
    if (!empty($sub_category)) {
        $id_sub_category = get_fb_page_sub_category($sub_category);
        if (empty($id_sub_category)) {
            $sub_category = mysql_real_escape_string($sub_category);
            $sql = "INSERT INTO facebook_page_sub_category VALUES(NULL, '{$sub_category}');";
            $res = mysql_query($sql) or die(mysql_error());
            if (mysql_affected_rows() > 0) {
                return mysql_insert_id();
            }
        } else {
            return $id_sub_category;
        }
    }
    return NULL;
}
Ejemplo n.º 2
0
 $first_local_fans_country_audience = "NULL";
 if (!empty($pages['first_local_fans_country'])) {
     $first_country_code = $countries[$pages['first_local_fans_country']]['code'];
     $first_country_name = $countries[$pages['first_local_fans_country']]['name'];
     $first_country_name_en = $countries[$pages['first_local_fans_country']]['name_en'];
     $first_local_fans_country_audience = $countries[$pages['first_local_fans_country']]['audience'];
     if (!in_array($pages['first_local_fans_country'], $id_country_uses)) {
         $id_country_uses[] = $pages['first_local_fans_country'];
     }
 }
 $idiom = "NULL";
 if ($pages['hispanic'] == 1) {
     $idiom = "es";
 }
 //Category
 $sub_category = get_fb_page_sub_category($id_page);
 $sub_category_id = $sub_category['id'];
 $sub_category_name = $sub_category['name'];
 //Subcategory
 $category = get_fb_page_category($sub_category_id);
 $category_id = $category['id'];
 $category_name = $category['name'];
 $general_ranking = 'NULL';
 $first_local_fans_country_ranking = 'NULL';
 $in_owloo_from = $pages['date_add'];
 $query = 'SELECT id_page FROM facebook_pages WHERE id_page = $10;';
 $que_page = db_query_table_results($query, array($id_page));
 if ($row = mysql_fetch_assoc($que_page)) {
     $query = "UPDATE facebook_pages SET  \n                                                parent = \$10,\n                                                fb_id = \$11, \n                                                username = '******', \n                                                name = '\$13', \n                                                about = " . ($about != "NULL" ? "'\$14'" : "\$14") . ",\n                                                description = " . ($description != "NULL" ? "'\$15'" : "\$15") . ",\n                                                link = '\$16',\n                                                picture = '\$17',\n                                                cover = " . ($cover != "NULL" ? "'\$18'" : "\$18") . ",\n                                                is_verified = \$19, \n                                                likes = \$20, \n                                                likes_history_30 = '\$21',\n                                                likes_grow_1 = \$22, \n                                                likes_grow_7 = \$23, \n                                                likes_grow_15 = \$24, \n                                                likes_grow_30 = \$25, \n                                                likes_grow_60 = \$26, \n                                                talking_about = \$27, \n                                                talking_about_history_30 = '\$28',\n                                                talking_about_grow_1 = \$29, \n                                                talking_about_grow_7 = \$30, \n                                                talking_about_grow_15 = \$31, \n                                                talking_about_grow_30 = \$32, \n                                                talking_about_grow_60 = \$33,\n                                                country_code = " . ($country_code != "NULL" ? "'\$34'" : "\$34") . ", \n                                                country_name = " . ($country_name != "NULL" ? "'\$35'" : "\$35") . ", \n                                                country_name_en = " . ($country_name_en != "NULL" ? "'\$36'" : "\$36") . ", \n                                                first_country_code = " . ($first_country_code != "NULL" ? "'\$37'" : "\$37") . ", \n                                                first_country_name = " . ($first_country_name != "NULL" ? "'\$38'" : "\$38") . ",\n                                                first_country_name_en = " . ($first_country_name_en != "NULL" ? "'\$39'" : "\$39") . ", \n                                                idiom = " . ($idiom != "NULL" ? "'\$40'" : "\$40") . ",\n                                                category_id = \$41,\n                                                category_name = " . ($category_name != "NULL" ? "'\$42'" : "\$42") . ",\n                                                sub_category_id = \$43,\n                                                sub_category_name = " . ($sub_category_name != "NULL" ? "'\$44'" : "\$44") . ",\n                                                first_local_fans_country_audience = \$45,\n                                                in_owloo_from = '\$46',\n                                                updated_at = NOW()\n                                                \n                                                WHERE id_page = \$47;";
     $values = array($parent, $fb_id, $username, $name, $about, $description, $link, $picture, $cover, $is_verified, $likes, $likes_history_30, $likes_grow_1, $likes_grow_7, $likes_grow_15, $likes_grow_30, $likes_grow_60, $talking_about, $talking_about_history_30, $talking_about_grow_1, $talking_about_grow_7, $talking_about_grow_15, $talking_about_grow_30, $talking_about_grow_60, $country_code, $country_name, $country_name_en, $first_country_code, $first_country_name, $first_country_name_en, $idiom, $category_id, $category_name, $sub_category_id, $sub_category_name, $first_local_fans_country_audience, $in_owloo_from, $id_page);
     $res = db_query_table_results($query, $values, 1);