HAi everybody,
I need help in flowing code
i want to people not equal to friend means show addas friend buuton otherwise not show button
this code show button more times
what is the problem in my logic
anybody plz help me.
This is my friends get query.
$query=$db->prepare("SELECT p.friend_id , p.layer_id
from layer l, people p
where l.personal_id = :personal_id
and l.id = p.layer_id
GROUP BY p.friend_id
");
$query->execute(array('personal_id' => $this->personal->getId()));
$this->friends = $query->fetchAll();
<?php
foreach($people as $p): ?>
<div id="vv-ppl-profile" class="friends">
<h3><?php echo $p["full_name"] ?></h3>
<a href="viewprofile?personal_id=<?php echo $p['id'] ?>" > <div class="vv-ppl-profile-thumb" style="background-image:url('<?php echo url_for('@image_display_new?from='.$p['primary_album_id'].'&type=personal&pic_id='.$p['profile_picture_id'], true); ?>') " >
</div></a>
<?php foreach($friends as $fr):?>
<?php if(($fr['id'])!=($p['id'])):?>
<div class="vv-ppl-cta vv-ppl-add">
<input type="hidden" value="<?php echo $p['id'] ?>" />
<p>Add Friend</p>
</div>
<?php endif;?>
<?php endforeach;?>
<?php endforeach;?>