Been brain storming and researching to get 2 index file.php. One to save session and cookie value to database and the second one would call and echo the saved session and cookie value from database when user visits again. Anyone can help?
In PHP, the session value are store in $_SESSION
, and $_COOKIE
for cookie value. The process can be as simple as create one table that has column consist of userid, session and cookie value, and write your code to save into the table. After that in the next visit retrieve it from the table by the user id.
PS: Why you want to keep the session and cookie value in the database though? Take not ethat as long as the session or cookie value is not been deleted, the value will be there until the next visit.
I found this on github and tried bit the session info was not saved to DB
But i was finally able to get what i was doing wrong with my php code. I was able to achieve the task using this in my corresponding php files
<?php echo $_SESSION['userId'];?>`$Id = $_SESSION['userId'];`$_SESSION['userId'] = $Id;`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.