already like/dislike topic

Started on the old forum in January 2011 · view the original in the archive · old links redirect here

3 replies · 879 views · started 15 years ago · 1 min read

3 participants
metulj Super moderator Principal · 1,726 posts #2

whitewingz wrote: i already solve it.. please delete this topic

so... why dont you share then ?

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

whitewingz Developer · 64 posts #3

metulj wrote: so... why dont you share then ?

ok ill share it when i finish this error i think u can help me? like this

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>"; }

something else Fellow · 2,296 posts #4
$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
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close