Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Explode > Friends Function

Featured Replies

Ok I have a script which gathers and splits friend results.

 

Which is below:

  $friends  = mysql_query("SELECT friends FROM members WHERE username = '".$_SESSION['uname']."'");
 while($row = mysql_fetch_array($friends)){

$people = explode(" ", $row['friends']);

if(num_rows($people) > 5){

echo 'true';
}
else
{
}
foreach($people AS $person){

$result = mysql_query("SELECT photo FROM members WHERE username = '".$person."'");

while($row = mysql_fetch_array($result)){
echo '<td><div class="photofile"><fieldset><legend>'.$person.'\'s Profile</legend><a title="'.$person.'"  href="profiles.php?username='.$person.'"><img src="thumb.php?file='.$row['photo'].'&size=140x80"></a></fieldset></div></td>';
}

}
}

 

Now I need it to display 4 table results per line.

 

i don't have time to give u a full solution cause im on my way out the door but i can tell u explode is used for creating an array and $row['friends'] is already an array so no need to use expload if u wanna join array elements together u can use implode(",",$row['friends']);

  • Author

i don't have time to give u a full solution cause im on my way out the door but i can tell u explode is used for creating an array and $row['friends'] is already an array so no need to use expload if u wanna join array elements together u can use implode(",",$row['friends']);

 

Thanks man :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.