hey guys, how to create profile like feature for lavalair script, plz share it
Profile like feature
Collapse
X
-
like feature
Originally posted by something else View Post
Comment
-
Originally posted by nclemale36 View Postsimple. add a like field in your users table .
add mysql_query(update like in users where like=$who blah blah blah blah .lol .
onlong those lines. try and try again you will never learn if you dont try .
Comment
-
create some sql eg:
PHP Code:CREATE TABLE `ibwf_profile_likes` (
`id` INT( 100 ) NOT NULL AUTO_INCREMENT ,
`uid` INT( 100 ) DEFAULT 0,
`likedby` INT( 100 ) DEFAULT 0,
PRIMARY KEY ( `id` )
);
PHP Code:$hasLiked = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_profile_likes WHERE uid='".$who."' AND likedby='".$uid."'"));
if($hasLiked[0]<1)
{
echo "<a href=\"profile.php?who=$who&sid=$sid&like=1\">Like</a><br/>";
}
else
{
echo "<a href=\"profile.php?who=$who&sid=$sid&like=0\">Dislike</a><br/>";
}
PHP Code:if($_GET['like']==1)
{
mysql_query("INSERT INTO ibwf_profile_likes SET uid='".$who."', likedby='".$uid."'");
}
if($_GET['like']==0)
{
mysql_query("DELETE FROM ibwf_profile_likes WHERE uid='".$who."' AND likedby='".$uid."'");
}
PHP Code:$numOfLikes = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_profile_likes WHERE uid='".$who."'"));
echo $numOfLikes[0]." Likes<br/>";
Comment
Comment