Create Session variables out of everything in a mysql table

Опубликовано: 15 Октябрь 2024
на канале: optikalefx
8,366
33

Scenario: Your making a website that uses user logins. Pretty common. When the user logs in you want to store all their mysql data in session variables so that while they are logged in you can access things like their email, products, names, address and anything else you put in the user table of your database. You could pick and choose which rows of mysql you wish to turn into Session variables and hard code them in. But with the foreach loop and some trickery we are able to turn everything from the user table about a particular user into session data.