I am stuck on a possibly very simple thing...just can't figure it out. I have this: echo "Pending Friends Are - " . $pending_friend_1 . "<br>";
in my loop. I need the $pending_friend_1
to be within the loop while outputting it, otherwise I do not get my full loop of results. How can I take out the text Pending Friends Are -
so that is still pieced together with the list. I am trying to do something like this:
Pending Friends Are -
Bob
George
Etc
<div id="main">
<?php
//Display pending friends
$friends_pending_sql = "
SELECT *
FROM friends
WHERE friend_two = ?
AND status = ?
";
$pending_friend_count_stmt = $con->prepare($friends_pending_sql);
$pending_friend_count_stmt->execute(array($user_id, $status_one));
$pending_friend_rows = $pending_friend_count_stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<div id="pending-request_count">Total Pending Friends -' . $total_pending_count . '</div>';
foreach ($pending_friend_rows as $pending_friend_row) {
$pending_friend_1 = $pending_friend_row['friend_one'];
$pending_friend_2 = $pending_friend_row['friend_two'];
$pending_friend_status = $pending_friend_row['status'];
$pending_friend_status_date = $pending_friend_row['date'];
$total_pending_friends = $pending_friend_1 . "<br>" . $pending_friend_2;
if ($pending_friend_2 == $user_id) {
echo "Pending Friends Are - " . $pending_friend_1 . "<br>";
}
else if ($pending_friend_1 = $user_id) {
echo "Friend Requests waiting for approval - " . $total_requests_sent_count . "<br>";
}
}
echo $friend_status_button;
echo $profile_viewer_message;
?>
'; } print_r($pending_friends); – Amir Hossain Nov 19 '16 at 05:44