If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: Problems In PhP, PLEASE HELP?
Click here to log in
What is the sum of 36 and 12
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
Problems In PhP, PLEASE HELP? 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.
Problems In PhP, PLEASE HELP?
Forum Rules