Advertisement
Guest User

Untitled

a guest
Feb 24th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. function activityType($activity_type){
  2.     switch ($activity_type) {
  3.     case 0:
  4.         echo "ERROR";
  5.         break;
  6.     case 1:
  7.         return "are now following user ID ";
  8.         break;
  9.     case 2:
  10.         return " have uploaded an photo, the photo ID is ";
  11.         break;
  12. }
  13. }
  14.  
  15. function activityFeed($CurrentUser){
  16.     $query = mysql_query("SELECT * FROM `follow` WHERE `user_id` = '$CurrentUser'") or trigger_error(mysql_error().$query);
  17.     while($row = mysql_fetch_array($query)){
  18.         @$following[] .= $row['follow_id']; // grabs a array of who current user is following e.g user_ids 3,8,34,75.
  19.        
  20.     }
  21.     foreach($following as $k => $value){
  22.     $query = mysql_query("SELECT * FROM `activity` WHERE `user_id` = '$value'") or trigger_error(mysql_error().$query); // grabs all activitys from each user i am following
  23.         while($row = mysql_fetch_array($query)){// for every activty per user display the activty.
  24.             @$activitys['id'][] = $row['id'];
  25.             @$activitys['user_id'][] = $row['user_id'];
  26.             @$activitys['source_id'][] = $row['source_id'];
  27.             //$activity_type = activityType($row['activity_type']);
  28.             //echo "I am following user $value . They ".$activity_type."".$row['source_id']."<br />";
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement