To'liq sonlarning yig'indisi fql ga qaytdi

Bu mening birinchi lavozimim va men PHP, MySQL uchun juda yangi va Facebook uchun rivojlanish qilaman.

Odatda, men bu ma'lumotni sql so'rovida ishlataman, lekin fql buni qo'llab-quvvatlamaydi. So'rovlar kutilgandek ishlaydigan albomlarni sinab ko'rmoqdaman, lekin faqatgina jami fotosuratlar/videolar soni echo ni xohlayman. I'm sure that solution is there Men buni aniq ko'rmayapman.

================================================== =

Hozir men ushbu natijalarni qaytarib olaman;

Albom # 1 = 50

Albom # 2 = 10

Albom # 3 = 25

va boshqalar.


Men faqat # bilan birga qaytganlarni qo'shishni xohlayman.

================================================== =

    try {
        $me = $facebook->api('/me');
        $fql    =   "SELECT photo_count, video_count FROM album WHERE owner=me()";
        $param  =   array(
                          'method'    => 'fql.query',
                          'query'     => $fql,
                          'callback'  => ''
                          );
        $fqlResult   =   $facebook->api($param);
        foreach($fqlResult as $row){
            echo "

"; echo $row['photo_count']; } } catch (FacebookApiException $e) { error_log($e); }

================================================== =====

Sizning yordamingiz quvonadi.

0

1 javoblar

  try {
        $me = $facebook->api('/me');
        $fql    =   "SELECT photo_count, video_count FROM album WHERE owner=me()";
        $param  =   array(
                          'method'    => 'fql.query',
                          'query'     => $fql,
                          'callback'  => ''
                          );
        $fqlResult   =   $facebook->api($param);
        $asset_count = 0;
        foreach($fqlResult as $row){
            $asset_count += (int)$row['photo_count'] + (int)$row['video_count'];               
        }
        echo "

"; echo $asset_count; } catch (FacebookApiException $e) { error_log($e); }
0
qo'shib qo'ydi
Ajoyib! Oshganingiz uchun juda ko'p rahmat, u hech qanday muammo yo'q edi.
qo'shib qo'ydi muallif Mountaininja, manba
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin