Jump to content

proctk

Members
  • Posts

    4
  • Joined

  • Last visited

proctk's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. proctk

    loop problem

    below is code that I'm trying to use to get data from the listed tables and then pull the data and display some of ithe information in a table.background I have a table where people add people to there buddy list. buddies or registered users add information to their profile and when someone adds a user to their buddy list then they can see certain pieces of information. my biggest problem is looping through the buddy list and using each buddy id to search through the tables with their information attached.The code below echoes the the value but repeats the same value many times.thank you for any helpcomplete code <?php $get_buddies_id = mysql_query("SELECT * FROM buddylink WHERE owner_id ='$user_id'") or die ("Error: getting buddies user_id" .mysql_error());while ($id_row = mysql_fetch_assoc($get_buddies_id)){$buddy_id = $id_row['buddy_id']; $buddy_calendar = mysql_query("SELECT * FROM `users` AS uINNER JOIN `calendar` AS c ON u.user_id = c.useridINNER JOIN `children` AS C ON u.user_id = C.owner_idINNER JOIN `parent` AS p ON u.user_id = p.owner_idINNER JOIN `sibling` AS s ON u.user_id = s.owner_idWHERE u.user_id = '{$buddy_id}'ORDER by u.user_id;") or die ("Error: getting buddies user_id:<br>\n" .mysql_error()); while ($row_buddy_info = mysql_fetch_array($buddy_calendar))echo $row_buddy_info['first_name'];}}?>
×
×
  • Create New...