SELECT * FROM dislikes WHERE pid = $post AND uid = $userid AND like = 1;
This query doesn't work (and I don't know why). Once I execute this query using mysqli and try to find num rows, I get
Notice: Trying to get property of non-object in C:\wamp\www\include\like.php on line 13
Just so that you know, the table dislikes is currently empty, has 4 columns: id, pid, uid and like.
EDIT:
echo "SELECT * FROM dislikes WHERE pid = $post AND uid = $userid AND like = 1;";
$result = $mysqli->query("SELECT * FROM dislikes WHERE pid = $post AND uid = $userid AND like = 1;");
$row_cnt = $result->num_rows;
This is the php code. The echo from the first line outputs:
SELECT * FROM dislikes WHERE pid = 2 AND uid = 3 AND like = 1;