Location: PHPKode > projects > ProjectPress > projectpress/like.php
<?php
/**
 * ProjectPress like a wall feed post
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();
define('access',true);
require_once(dirname(__FILE__) . '/config.inc.php');
require_once(PM_DIR . 'pm-includes/global.inc.php');
	
	if($_REQUEST['postId']) {
		$username = $_SESSION['username'];
		
		pmdb::connect()->query("update ". DB ."wall_posts set likes=likes+1 where p_id= '".$_REQUEST['postId']."'");
		
		pmdb::connect()->query("INSERT INTO ". DB ."wall_likes_username (l_user,post_id) VALUES('".$username."','".$_REQUEST['postId']."')");
		
		$total_likes = pmdb::connect()->query("SELECT * FROM ". DB ."wall_posts where p_id = '".$_REQUEST['postId']."'");
		$likes = $total_likes->fetch_array();
		$likes = $likes['likes'];
	}
	echo $likes;
Return current item: ProjectPress