Hi every one,

i am making a database table which count how much times page reloaded.

i have create a variable in session and assign it a value "0";

now i want when page reloaded this value of session variable will increase with 1.

how can i do this. please help me to do this.



I am developing an application using Visual Studio 2010 and SQLServer 2008. My application has two pages and the first page contains a GridView with all the records "User Administration" and when user click on any Username (template field ->linkbutton) I read the USERID like this.

Session["UserID"] = e.commandArgument;

which takes it to the Data Entry page where user updates the information and save the data.

The problem i am facing is that when I hit the browser REFRESH button couple of times the session variables looses the value which is trouble for me as I am using Session Variables for different purposes.

Any workaround or suggestions for improvement.

Thanks Wine Opener

Hello sainigks. Well, you can do this with sessions. You can try

</php $_SESSION['page_reload'] =  $_SESSION['page_reload'] + 1; 
echo $_SESSION['page_reload']; ?>

. You will see that pageloads will increase. After that, you will update your row in your database. Something like

UPDATE <table_name> SET loads= <value from session> WHERE page_id=<$_GET['page_id']>.

This is more like a pseudocod. I hope it will help you. You can find many script on the internet and i am sure you will find other answers here aswell. Regards, Darius.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.