php - Im wanting to make it so page views only get raised if its someone who hasnt visited before -


This section of the code is on the article page, and I'm basically creating a page that has been viewed page_ and if If this is incorrect then add a view and also the ID of the article in the IP and other tables so that I can see that the user has already visited the page. If they should echo this 'you are present', it is not working and I do not know why

  if (page_ viewed ($ id) === incorrect) {mysql_query ("UPDATE Main_posts SET` view` = `view` + 1 WHERE article_id = '$ id'"); Mysql_query ("INSERT views in SET user_ip = '". $ _SERVER [' REMOTE_ADDR '].' ', Article_id =' $ id '");} and {echo' you exist ';}  

This function is in the init.php file.

  // page-like function page_viewed () {$ user_ip = $ _SERVER ['REMOTE_ADDR']; $ Query = mysql_query 'WHERE` user_ip` = $ user_ip and `article_id` = $ id") from the SELECT COUNT (`user_ip`) views; return (mysql_result ($ query, 0) == 1) right? Wrong;}  

If someone can help me then it would be nice to be new to coding. Thanks in advance.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -