Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

creating a session from info in mysql

Featured Replies

hi all i am trying to create a session for all the infomation in mysql database i can create the session from the login infomation giving me the username what i am trying to do is create a classifieds page which is working as i want except the seller needs to type there email username and other details as well,i want is so that the user just needs to enter the name of the item for sale description and 3 photos without having to retype the email username telephone number etc any ideas thanks again

I will assume that you have a "users" table that has fields similar to:

 

user_id (int)

first_name (varchar)

last_name (varchar)

email (varchar)

password (varchar)

 

When the user logs in you will run a query to authenticate them with a username and password.

if the user is authenticated store the "user_id" in a session $_SESSION['user_id']

 

You can then look up the data for that user_id in your table any time you like by doing something a bit like this:

 

$strSQL = "SELECT first_name,
                 last_name,
	  email
            FROM users
    WHERE user_id ='".$_SESSION['user_id']."'";

Don't forget to include session_start() at the top of your script.

  • Author
I will assume that you have a "users" table that has fields similar to:

 

user_id (int)

first_name (varchar)

last_name (varchar)

email (varchar)

password (varchar)

 

When the user logs in you will run a query to authenticate them with a username and password.

if the user is authenticated store the "user_id" in a session $_SESSION['user_id']

 

You can then look up the data for that user_id in your table any time you like by doing something a bit like this:

 

$strSQL = "SELECT first_name,
                 last_name,
	  email
            FROM users
    WHERE user_id ='".$_SESSION['user_id']."'";

Don't forget to include session_start() at the top of your script.

 

thanks for this i add managed to work it out from books thanks for the reply though

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.