Docs about temp tables say that when the connection and the session is closed the local temporary table are dropped automatically.
But doesn't PHP work this way? Any variable I want to persist ( for a single user) I need to keep in a session variable. When does a session close in PHP? Is there a specific statement I need to avoid so I don't drop my temp table?
There is no link between a "database session" and a "PHP session", and no way to make such a link.
The way a "database session" works is this:
Meanwhile, a "PHP session" works like this:
Note that at no point do you choose which database connection to use, or have any way of "storing" it between requests.
If you want data to persist between requests, you need to store it somewhere other than a temporary database table - a permanent database table, or a PHP variable serialized into the PHP session.
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.