Jump to content

Printing info from array returned by facebook?


nitromaster

Recommended Posts

Hi

I'm a total newb at php....however I know how to list info from a multi-arrayed array (or whatever its called) from the facebook api.

 

Like

echo '<table>';
$columns = 4;
$currCol = 1;
$photos = $facebook->photos_get('', $_GET["aid"], '');
foreach($photos as $userData)
{
   if ($currCol==1)
   {
      echo "<tr>";
   }

	echo '<td><div style="text-align: center; padding: 10px;">
<a href="http://apps.facebook.com/myapp/add.php?fb_page_id=' . $page_id . '&aid=' . $userData['aid'] . '&owner=' . $userData['owner'] . '&pid=' . $userData['pid'] . '">
<fb:photo pid="' . $userData['pid'] . '" size="s" />
<br/>
<a href="http://apps.facebook.com/myapp/add.php?fb_page_id=' . $page_id . '&aid=' . $userData['aid'] . '&owner=' . $userData['owner'] . '&pid=' . $userData['pid'] . '">
' . $userData['caption'] . '</a></div></td>';

   if ($currCol==$columns)
   {
      echo "<tr>";
      $currCol=0;
   }
   $currCol++;
}

The returned arrays outputted above look like

Array
(
    [0] => Array
        (
            [pid] => 12402342
            [aid] => 0
            [owner] => 1
            [src] => "http://bb.bebo.com/bb/medium/2005072816/1a12402342b495956441m.jpg"
            [src_big] => "http://bb.bebo.com/bb/large/2005072816/1a12402342b833304858l.jpg"
            [src_small] => "http://bb.bebo.com/bb/small/2005072816/1a12402342b733848302s.jpg"
            [link] => "http://www.bebo.com/PhotoAlbumBig.jsp?MemberId=1&PhotoAlbumId=0&PhotoId=12402342"
            [caption] => "13517565a18343b5945356l.gif"
            [created] => 1122569080000
        )
    [1] => Array
        (
            [pid] => 5076242936
            [aid] => 0
            [owner] => 1
            [src] => "http://i4.bebo.com/036a/15/medium/2007/06/21/14/4186319815a4748043833b623364386m.jpg"
            [src_big] => "http://i4.bebo.com/036a/15/large/2007/06/21/14/4186319815a4748043833b245635494l.jpg"
            [src_small] => "http://i4.bebo.com/036a/15/small/2007/06/21/14/4186319815a4748043833b523511584s.jpg"
            [link] => "http://www.bebo.com/PhotoAlbumBig.jsp?MemberId=1&PhotoAlbumId=0&PhotoId=5076242936"
            [caption] => "DSC00304"
            [created] => 1185318973000
        )
)

 

However I'm having difficulties doing something similar with friends. As i said I'm a total newb. I can do the above where each album is in a array but cannot figure out how to list links with the friends.get method as they aren't in arrays.

The returned data for friends.get is like

Array
(
    [0] => 1
    [1] => 2
)

 

 

Want to do something like a foreach with each id ending up outputting:

<a href="http://apps.facebook.com/myapp/friend.php?fb_page_id=' . $page_id . '&friendid=' . $friendid . '"><br/>

But no idea how to do this without each term being in an array.

 

Any help?

 

Thanks

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.