so here is my code for like system
<div class="btn like">
<div class="boxcoracao">
<?php foreach ($db->checklike($postid,$session_id) as $chk) {
if($postid== $chk['pl_puid'] && $session_id == $chk['pl_uid']){
?>
<input type="hidden" name="likepid" id="likepid" value="<?php echo $postid ?>">
<input type="hidden" name="likemid" id="likemid" value="<?php echo $mem_id ?>">
<span class="coracao ativo" name="like"><br>   Love</span>
<?php
}else{
?>
<input type="hidden" name="likepid" id="likepid" value="<?php echo $postid ?>">
<input type="hidden" name="likemid" id="likemid" value="<?php echo $mem_id ?>">
<span class="coracao" name="like"><br>   Love</span>
<?php
}
}
?>
</div>
</div>   
what happen here is if sessionID exists on the DB the if statement will run if not else will... but what happens is after writing this code my button disappear
sql query
function checklike($pid,$mid){
$query = "SELECT * FROM plike WHERE pl_puid = '$pid' AND plc_uid = '$mid'";
$stmt = $this->dbh->prepare($query);
$stmt->execute(array("0"));
$active_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $active_data;
}
also im confuse im in going to use forloop for this??.. any better idea on how to do it...
this button refers to the default icon if the user didn't hit like
this button refers to the icon where the user hit like
but what happens on the above code is it disappears the button since the button is inside the if statement i dont have any idea on how to do it.. any idea please..