denny911 Posted December 3, 2005 Share Posted December 3, 2005 Hi,If you want, go to my testing site at hhtp://d.1asphost.com/krajinaonline/ and take a look so it'll be easier to understand what i want.I want to add the code that will increase value by "1" every time user opens a page."This article is commented: xx times" (i already have this one and it's working)"This article is viewed: xx times" (on my page, here i put the same code as above but i've added (+8) just to make it seem different from above - it does NOT what it is supposed to)so, after the first user reads an article, there should be "1 times", and after another user reads that article, there should be "2 times" and so on..i suppose the value should be stored in my database, but how? And what code should i use?thanks! Link to comment Share on other sites More sharing options...
LBY Posted December 3, 2005 Share Posted December 3, 2005 Hi,If you want, go to my testing site at hhtp://d.1asphost.com/krajinaonline/ and take a look so it'll be easier to understand what i want.I want to add the code that will increase value by "1" every time user opens a page."This article is commented: xx times" (i already have this one and it's working)"This article is viewed: xx times" (on my page, here i put the same code as above but i've added (+8) just to make it seem different from above - it does NOT what it is supposed to)so, after the first user reads an article, there should be "1 times", and after another user reads that article, there should be "2 times" and so on..i suppose the value should be stored in my database, but how? And what code should i use?thanks!<{POST_SNAPBACK}> You want a counter to check how many people read the article?Just make in your database another colum "Counter" and do that everytime someone enters the page it will add the same article Counter colum 1 Link to comment Share on other sites More sharing options...
denny911 Posted December 4, 2005 Author Share Posted December 4, 2005 You want a counter to check how many people read the article?Just make in your database another colum "Counter" and do that everytime someone enters the page it will add the same article Counter colum 1<{POST_SNAPBACK}> ok, but how am i supposed to do that? should i open a database connection and thenSELECT * FROM counter..can you continue? thanks for your response if there's gonna be any..Denis Link to comment Share on other sites More sharing options...
m33tmn Posted December 5, 2005 Share Posted December 5, 2005 use 2 cols: Hits and x, hits has auto-incresementeverytime someone sees the page, it will add something to the table. and then you just use the query Select count(x) fraom yourtableand it will give the number. OR if you need more than one counter (meaning 2 different articles) you can put different numbers into x. so for example article 1 will add 1 to the table, and article 2 will add 2 to the table. then you can count them the same way, just add "WHERE x = 1" or "WHERE x = 2" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now