top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to create our own session in php?

0 votes
47 views

Give some sample code for creating session in php.Also,provide some sample link for learning about session in php.

posted Sep 29, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

For creating session first you need to start the session by using below code

session_start(); 

Then using $_SESSION we can create a session variable.

Example Code:

<?php session_start(); // store session data $_SESSION['views']=1; ?>

<html>
<body>

<?php
//retrieve session data
echo "Pageviews=". $_SESSION['views'];
?>

</body>
</html>

More Reference visit -> http://www.w3schools.com/php/php_sessions.asp

answer Sep 30, 2014 by Sandeep Bedi
Similar Questions
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...