i already solve it.. please delete this topic
already like/dislike topic
Collapse
X
-
Originally posted by whitewingz View Posti already solve it.. please delete this topicIt's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ â“â“¡â“” â“ⓑⓛⓔ ⓣⓞ â“—â“”â“â“¡ !
ιη тнєσÑу, тнє ÏÑα¢тι¢є ιѕ α Ñєѕυℓт σƒ тнє тнєσÑу, вυт ιη ÏÑα¢тι¢є ιѕ тнє σÏÏσѕιтє.
-
Originally posted by metulj View Postso... why dont you share then ?
when user not like or dislike the topic the link of like and dislike topic is visible right?
and when the user already is hitted the like/dislike in topic the link in like and dislike must be not clickeble or it is visible only visible is the result like this..
not hitted the like/dislike
like(0) dislike(0)
and already hitted
like(1) dislike(0)
this is my code that can base for it..
$vdone = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_like WHERE uid='".$uid."' AND target='".$tid."'"));
$nov = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_like WHERE target='".$tid."'"));
$nov = $nov[0];
if($vdone[0]>0)
{
$voted= true;
}else{
$voted = false;
}
$likes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_like WHERE target='".$tid."' AND action='liketopic'")); //changable
$dislikes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_dislike WHERE target='".$tid."' AND action='disliketopic'")); //changable
if($voted)
{
$lnk = "like($likes[0]]) dislike($dislikes[0])";
}else{
$lnk = "a href=\"index.php?do=liketopic&tid=$tid&sid =$sid\">Like($likes[0])</a> <a href=\"index.php?do=disliketopic&tid=$tid& sid=$sid\">Dislike($dislikes[0])</a>";
}
Comment
-
PHP Code:$vdone = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_like WHERE uid='".$uid."' AND target='".$tid."'"));
$nov = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_dislike WHERE uid='".$uid."' AND target='".$tid."'")); //changed to fetch dislikes of user
if($vdone[0]>0||$nov[0]>0) // added has user disliked ?
{
$voted= true;
}else{
$voted = false;
}
$likes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_like WHERE target='".$tid."' AND action='liketopic'")); //changable
$dislikes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_dislike WHERE target='".$tid."' AND action='disliketopic'")); //changable
if($voted)
{
$lnk = "like($likes[0]) dislike($dislikes[0])"; //removed extra ]
}else{
$lnk = "<a href=\"index.php?do=liketopic&tid=$tid&sid=$sid\">Like($likes[0])</a> <a href=\"index.php?do=disliketopic&tid=$tid&sid=$sid\">Dislike($dislikes[0])</a>"; //removed the 2 spaces that shouldnt be there next to both $sid and added missing < at start
}
Last edited by something else; 29.01.11, 17:14.
Comment
Comment