I have code that allows me to vote for a particular article I have written, however, I want to set it so that I may only like the article once, but its still letting me like it as many times as i like because the function isnt working
here is the code for the function(in like.php) that is supposed to do this:

Line 7: function previously_liked($article_id) {
Line 8: $article_id = (int)$article_id;
Line 9: return (mysql_result(mysql_query("SELECT COUNT (`like_id`) FROM `likes` WHERE `user_id` = ".$_SESSION['user_id']." AND `article_id` = $article_id"), 0) == 0) ? false : true;

And This Is In My Index Page That Calls for the function (the first part adds one vote too article one).

add_like(1);

if (previously_liked(1) === true) {
echo 'You\'ve Already Liked This';
}

But It Gave Me This Error:

Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\LikeButton\core\func\lik... on line 9

And The Function Didn't limit me to one vote, It Allowed Me To Vote An Article As Many Times As I Liked.

Thank You For Reading, And Pleeaseee Help Me With The Solution.