Hello Pravesh, A PHP session variable is used to store information about, or change settings for a user session. Before you can store user information in your PHP session, you must first start up the session. session_start() function is used for start session into PHP page. To resolve your problem you can try something like following code. PHP Script Code:
<?php
// Start Session
session_start();
// check session value has been set or not
if(isset ($_SESSION['PageViewUser']))
{ // increment counter by 1 if session value is already set
$_SESSION['PageViewUser'] = $_SESSION['PageViewUser']+ 1 ; }
else
{ // if session value not set, then value set by 1 in session variable $_SESSION['PageViewUser'] = $_SESSION['PageViewUser']+1 ; } ?>
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
A PHP session variable is used to store information about, or change settings for a user session. Before you can store user information in your PHP session, you must first start up the session. session_start() function is used for start session into PHP page.
To resolve your problem you can try something like following code.
PHP Script Code:
<?php // Start Session session_start(); // check session value has been set or not if(isset ($_SESSION['PageViewUser'])) {// increment counter by 1 if session value is already set
$_SESSION['PageViewUser'] = $_SESSION['PageViewUser']+ 1 ;
} else {
// if session value not set, then value set by 1 in session variable
$_SESSION['PageViewUser'] = $_SESSION['PageViewUser']+1 ;
} ?>
For more details about Session or Session Variable in PHP visit this URL:
http://mindstick.com/Articles/660ef403-4dff-4ed7-8199-dc6daafb1ee7/?PHP%20Session