Skip to main content
Known Participant
July 20, 2020
Question

RECALLING DATA FROM PHPMYADMIN

  • July 20, 2020
  • 2 replies
  • 782 views

I have created a site where i am asking the user to register with their Fname / Sname / Email / Mobile

 

Can anyone explain how i can recall indivdual profile up into my site when a user sign's in.

 

right now no matter which user sign's in.. it seems only to recall the data for user id 1 in my database.

 

Hope this makes sense.

 

Thank you all....

Deepak

 

    This topic has been closed for replies.

    2 replies

    Legend
    July 20, 2020

    You would have to use a WHERE clause in the sql query which queries the database for a specific user based on usually the 'username' which the user is asked to create when they 'join' your website. Each 'username' created MUST be unique, otherwise the data can be shared in instances where there are duplicated entries in the database.

     

    SELECT username FROM  users WHERE username = "$username"

     

    $username being the variable passed from the form input field:

     

    $username =  $_POST['username'];

     

    In your case you would use the email address as the 'username' which a lot of websites do. Just make sure the email addresses are unique in your database. ie No more than one user can have the same email address.

     

    Any $_POST variable from form input fields should be sanitised before you query the database to stop database injection attacks.

     

    Deepak MAuthor
    Known Participant
    July 21, 2020

    Hi Thank you for your reply.

     

    Please can you adivse is this the right way to code your suggestion:-

     

    SELECT username FROM  users WHERE username = "$Email"

     

    also where would i enter this code... should i be in all files or just initial login file ?

     

    Thanks

     

    Deepak

     

    Legend
    July 21, 2020

    Its a bit more complex than that. Have you been through the tutorial that Nancy supplied in her link?

     

    I was just providing you with the basic logic behind what you need to do to get a specific users details from your database. We dont exactly know how you are quering your database BUT I would assume using the built in Dreamweaver server behaviours which are extremely outdated - no-one around here has supported them for years, so you wont get much help.

     

    You should be  using the new improved mysqli or PDO method to query your database then you will most probably recieve more guidance, already a tutorial has been suggested which you should read as that covers the process.

     

     

    Nancy OShea
    Community Expert
    Community Expert
    July 20, 2020

    To clarify terms, phpMyAdmin is software for working with a server-side database.  Data are stored inside tables within a MySQL database.

     

    See tutorial below on Creating a User Log-in System with PHP & MySQLi.

    https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php

     

    Or you can purchase commercial extensions like this one from WebAssist

    http://www.webassist.com/product/mysqli

    http://assets.webassist.com/html-help/363/index.html

     

    Nancy O'Shea— Product User & Community Expert