Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a following html table in threads.php



Posted by:At: On: Topic Name: Replies:

myname12308:51:51 AM11th September 2013 topic-2 0
myname00108:51:10 AM11th September 2013 topic-1 0

Problem is suppose i have one reply in topic-2. Now if i try to display the total number of replies correspond to topic-2, it is just
display it like this-


Posted by:At: On: Topic Name: Replies:

pankaj645 08:51:51 AM 11th September 2013topic-2 1
pankaj645 08:51:10 AM 11th September 2013topic-1 1

As you can see it displaying total number correspond to topic-1 too.
plz tell me what should i do?
Posted

1 solution

As HTTP is a stateless protocol, each of your PHP scripts is executed on a separate HTTP request. To count them, you need to have some persistent object to accumulate the number of requests on a certain topic (under certain constraints, whatever it is). Such object could be a file on your server side or a database. On each request, you open a file, read the value, increment it and write the file back. Or modify a value in your database.

—SA
 
Share this answer
 
Comments
Pankaj Mahor 15-Sep-13 14:18pm    
Can you plz provide code example?
Sergey Alexandrovich Kryukov 15-Sep-13 14:51pm    
Please see http://bit.ly/19V2u6s.
—SA
Pankaj Mahor 16-Sep-13 5:01am    
whats this?
Sergey Alexandrovich Kryukov 16-Sep-13 9:02am    
Excuse me?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900