First off, yes, I know mysql_num_rows()
is deprecated.
Now, continuing on to the actual question, I'm making a page where users can post things and other users can like them. But when the post displays, and the user viewing them didn't/hasn't liked the post, the mysql_num_rows()
doesn't work.
Here's my code:
<?
$plikes=mysql_query("SELECT * FROM postLikes WHERE username='$myusername' AND postId='$postId'");
$plikesRows=mysql_num_rows($plikes)or die("error: ".mysql_error());
if ($plikesRows>=1) {
//stuff
}
else {
//other stuff
}
?>
the variables $myusername
and $postId
are set correctly, and I tested the query and it works without any errors. But when I go onto the page, all it displays is a "error:", without any error.