I have a login.php file in which an user can log in by his name and password. This file has $username and $password variables.
After login, the user will go to his OWN table, the name of the table the SAME with username.
User can delete, updata records in this table by using a data.php file. This data.php is used for many users (in the same database). I have to declare $table_name variable so that each user will assign his own table_name by his username.
Before you send anything for output onto the page you will have to call session_start(). This will start a session.
On the login page, when they login, you will also have to call this. Once called, you'll need to session_register($username) so that, that username is like a global variable for that session. That way when they go to data.php and you have already called session_start() on this page, the session variable $username is present, and so you can use it in your script.
Remember with sessions that you must start the session before you send anything out onto the page. It might also be helpful to include a logout.php page where the user can log out.
Bookmarks