Example #1
0
function like_dislike()
{
    if (!empty($_SESSION['mno'])) {
        if (empty($_GET['unlike'])) {
            if (!select_w_2('posted_looks_comments_like_dislike', 1, array('plcno', $_GET['comment_id'], 'mno', $_SESSION['mno']), 'and')) {
                insert('posted_looks_comments_like_dislike', array('plcno', 'mno'), array($_GET['comment_id'], $_SESSION['mno']), 'plcldno');
                $total_like = select('posted_looks_comments_like_dislike', 3, array('plcno', $_GET['comment_id']));
                count_total_like($total_like);
                // echo "Sucesfully like the comment ";
            } else {
                $total_like = select('posted_looks_comments_like_dislike', 3, array('plcno', $_GET['comment_id']));
                count_total_like($total_like);
            }
        } else {
            delete_w_2('posted_looks_comments_like_dislike', array('plcno', $_GET['unlike'], 'mno', $_SESSION['mno']), 'and');
            // echo "Sucesfully unlike the comment";
            $total_like = select('posted_looks_comments_like_dislike', 3, array('plcno', $_GET['unlike']));
            count_total_like($total_like);
        }
    }
}
Example #2
0
function total_like($plcno)
{
    $total_like = select('posted_looks_comments_like_dislike', 3, array('plcno', $plcno));
    return intval(count_total_like($total_like));
}