Highlighted

RECALLING DATA FROM PHPMYADMIN

Community Beginner ,
Jul 20, 2020

Copy link to clipboard

Copied

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

 

Views

144

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

RECALLING DATA FROM PHPMYADMIN

Community Beginner ,
Jul 20, 2020

Copy link to clipboard

Copied

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

 

Views

145

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 20, 2020 0
Adobe Community Professional ,
Jul 20, 2020

Copy link to clipboard

Copied

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, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 20, 2020 2
LEGEND ,
Jul 20, 2020

Copy link to clipboard

Copied

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.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 20, 2020 2
Community Beginner ,
Jul 21, 2020

Copy link to clipboard

Copied

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

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 21, 2020 0
LEGEND ,
Jul 21, 2020

Copy link to clipboard

Copied

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.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 21, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

Hi thank you,

 

Yes i have been through the link. My issue is not login or ensuring the correct user is logging in.

 

My issue is more after they have logged in...

 

once logged in, no matter which user sucessfully logs in, the information that is displayed when they click on my personal details button is always record number 1 in my database table and not their respective record/information.

 

This is what i need help with.

 

Many Thanks

 

Deepak

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
LEGEND ,
Jul 22, 2020

Copy link to clipboard

Copied

Without seeing what code you are using we cant' help. If I'm guessing correctly and you are using the inbuilt (out of date) DW server behaviours then I doubt anyone will bother to provide a solution as no-one in this forum, of an concequence, uses that workflow any longer.

 

If you have used a more up-to-date workflow then you may find someone that could advise you.

 

First you have to post some code to show us.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

Am i able to share files here... i think then maybe you would get a better idea...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

<?php require_once('Connections/IH_PassData.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_IH_PassData, $IH_PassData);
$query_Information = "SELECT * FROM passenger";

$Information = mysql_query($query_Information, $IH_PassData) or die(mysql_error());
$row_Information = mysql_fetch_assoc($Information);
$totalRows_Information = mysql_num_rows($Information);


 

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
#Container {
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
}
#Header {
    height: 140px;
    width: 360px;
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
}
#Logo {
    float: left;
    height: 120px;
    width: 110px;
    margin-top: 10px;
    border-width: 0px;
    border-style: solid;
    text-align: center;
}
#HomeContUs {
    float: right;
    height: 120px;
    width: 235px;
    margin-top: 10px;
    margin-bottom: 10px;
    border-width: 0px;
    border-style: solid;
}
#Home {
    float: left;
    height: 120px;
    width: 110px;
    margin-top: 0px;
    border-width: 0px;
    border-style: solid;
    margin-bottom: 10px;
    text-align: center;
}
#ContactUs {
    float: right;
    height: 120px;
    width: 110px;
    border-width: 0px;
    border-style: solid;
    margin-left: 10px;
    text-align: center;
    font-size: 14px;
    font-family: "Segoe UI Historic";
    font-style: normal;
    font-weight: bolder;
}
#MainBody {
    height: 590px;
    width: 360px;
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
}
#telicon {
    float: left;
    height: 55px;
    width: 55px;
    margin-top: 20px;
    border-width: 0px;
    border-style: solid;
    text-align: center;
}
#texticon {
    float: right;
    height: 55px;
    width: 55px;
    margin-top: 20px;
    border-width: 0px;
    border-style: solid;
    text-align: center;
}
#HButton {
    height: 70px;
    width: 70px;
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
    margin-top: 0px;
}
#Buttons {
    height: 60px;
    width: 360px;
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
}
#PerSym {
    float: left;
    height: 30px;
    width: 30px;
    margin-left: 10px;
    border-width: 0px;
    border-style: solid;
    text-align: center;
    margin-top: 5px;
}
#PassDetails {
    height: 25px;
    width: 170px;
    margin-top: 10px;
    border-width: 0px;
    border-style: solid;
    font-size: 17px;
    font-family: "Segoe UI Historic";
    font-style: normal;
    font-weight: bold;
    margin-left: auto;
    margin-right: auto;
}
#Details {
    height: 495px;
    width: 350px;
    margin-right: auto;
    margin-bottom: auto;
    border-width: 0px;
    border-style: solid;
    margin-top: 0px;
    margin-left: auto;
    padding-left: 0px;
    text-align: left;
    font-size: 13px;
    font-family: "Segoe UI Historic";
    font-style: normal;
    font-weight: normal;
}
 .input{
    border: 1px solid;
    color: #13205E;
    border-radius: 5px;
    width: 180px;
    height: 18px;
    outline: none;
    padding-left: 3px;
 }
 .SPDName{
  width: 100px;
  height: 18px;
  font-family: "Segoe UI Historic";
  font-size: 14;
  border: 1px solid;
  color: #13205E;
  border-radius: 5px;
  outline: none;
 }
 .SPDEmail{
    width: 260px;
    height: 18px;
    font-family: "Segoe UI Historic";
    font-size: 13px;
    border: 1px solid;
    colour: #13205E;
    border-radius: 5px;
    outline: none;
    text-align: left;
 margin-left: 5px;
 }

#TravelTypeDetails {
    height: 25px;
    width: 200px;
    margin-right: auto;
    margin-left: auto;
    border-width: 0px;
    border-style: solid;
    text-align: center;
    font-size: 17px;
    font-weight: bold;
}
#PerSym {
    float: left;
    height: 25px;
    width: 20px;
    border-width: 0px;
    border-style: solid;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.osrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body onLoad="MM_preloadImages('Images/PassTrvDetail-LBlue.png','Images/DepPro-LBlue.png','Images/ArrvPro-LBlue.png','Images/Plane-LBlue.png','Images/Train-LBlue.png','Images/Cruise-LBlue.png')">
<div id="Container">
  <div id="Header">
    <div id="Logo"><img src="Images/GLOBE-MSTR-WITH-IMHERE2V2.png" width="110" height="110" alt="ImHereLogo"/></div>
    <div id="HomeContUs">
      <div id="Home">
        <p><a href="main_menu.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Images/home-light-blue.png',1)"><img src="Images/home-blue.png" alt="HomeButton" width="70" height="80" id="Home2"></a></p>
      </div>
      <div id="ContactUs">
        <div id="telicon"><img src="Images/telephone.png" width="50" height="50" alt=""/></div>
        <div id="texticon"><img src="Images/text.png" width="50" height="50" alt=""/></div>
        CONTACT US
      </div>
    </div>
  </div>
  <div id="MainBody">
    <div id="Buttons">
      <table width="360" height="66" border="0" align="center" cellpadding="3" cellspacing="5">
        <tbody>
          <tr>
            <td width="107" height="56" align="left"><a href="passtraveldetails.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('PassTrvDtls','','Images/PassTrvDetail-LBlue.png',1)"><img src="Images/PassTrvDetail-DBlue.png" alt="PassengerTravelDetailsButton" width="100" height="50" id="PassTrvDtls"></a></td>
            <td width="107" align="center"><a href="departuerprog.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('DepDtls','','Images/DepPro-LBlue.png',1)"><img src="Images/DepPro-DBlue.png" alt="DepartureProgressButton" width="100" height="50" id="DepDtls"></a></td>
            <td width="108" align="right"><a href="arrivalsprog.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ArvProg','','Images/ArrvPro-LBlue.png',1)"><img src="Images/ArrvPro-DBlue.png" alt="ArrivalsProgressButton" width="100" height="50" id="ArvProg"></a></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div id="PassDetails">PASSENGER DETAILS </div>
    <div id="Details">
   <form id="passdetails" name="passdetails" method="get">
      <table width="340" border="0" align="center" cellpadding="3" cellspacing="3">
        <tbody>
          <tr>
            <td align="right" style="font-size: 13px"><label for="textfield">First Name</label></td>
            <td><input name="FName" type="text" class="input" id="FName" value="<?php echo $row_Information['FName']; ?>"></td>
          </tr>
          <tr>
            <td align="right" style="font-size: 13px"><label for="textfield2">Surname</label></td>
            <td><input name="SName" type="text" class="input" id="SName" value="<?php echo $row_Information['SName']; ?>"></td>
          </tr>
          <tr>
            <td align="right" style="font-size: 13px"><label for="textfield3">Mobile</label></td>
            <td><input name="Mobile" type="text" class="input" id="textfield3" value="<?php echo $row_Information['Mobile']; ?>"></td>
          </tr>
          <tr>
            <td align="right" style="font-size: 13px"><label for="email">Email:</label></td>
            <td><input name="email" type="email" class="input" id="email" value="<?php echo $row_Information['Email']; ?>"></td>
          </tr>
        </tbody>
      </table>
   </form>
  <span style="margin-left: 10px; font-family: 'Segoe UI Historic'; font-size: 14px; font-weight: bold"> Share progress details with:</span>
      <form id="SPD" name="SPD1" method="get">
        <table width="320" border="0" align="center" cellpadding="2" cellspacing="2">
          <tbody>
            <tr>
              <td width="38"><label for="textfield" >Name</label></td>
              <td width="107"><input type="text" name="textfield" class="SPDName"id="textfield"></td>
              <td width="44" align="right"><label for="textfield2">Mobile</label></td>
              <td width="135" align="left"><input name="textfield2" type="text" class="SPDName" id="textfield2"></td>
            </tr>
            <tr>
              <td colspan="4"><label for="email2">Email </label>
              <input type="email" name="email2" id="SPDEmail" class="SPDEmail" ></td>
            </tr>
          </tbody>
        </table>
        <div id="TravelTypeDetails">TRAVEL TYPE / DETAILS</div>
      </form>
      <table width="254" border="0" align="center" cellpadding="3" cellspacing="3">
        <tbody>
          <tr>
            <td width="106" align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Plane','','Images/Plane-LBlue.png',1)"><img src="Images/Plane-DBlue.png" alt="PlaneButton" width="60" height="25" id="Plane"></a></td>
            <td width="107" align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Train','','Images/Train-LBlue.png',1)"><img src="Images/Train-DBlue.png" alt="TrainButton" width="60" height="25" id="Train"></a></td>
            <td width="107" align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Cruise','','Images/Cruise-LBlue.png',1)"><img src="Images/Cruise-DBlue.png" alt="CruiseButton" width="60" height="25" id="Cruise"></a></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
Content for  id "Container" Goes Here</div>
</body>
</html>
<?php
mysql_free_result($Information);
?>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

once the user once they have successfully logged in with their email/ password they will go directly to main menu... they then select personal details and this is where they are directed to and where their personaly information should be displaying. As mentioned , it only seems to retrieve the first record.

 

Thank you

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
LEGEND ,
Jul 22, 2020

Copy link to clipboard

Copied

There is no 'WHERE' clause in your database query?

 

You're just selecting ALL the passengers details and it will only ever print out the first passengers details in the returned data, unless you specifically select a passenger by their unique email adddress

 

This:

$query_Information = "SELECT * FROM passenger";

 

Should be more like:

$query_Information = "SELECT * FROM passenger WHERE email = '$email'";

 

Where 'email' is the column name in your database and $email is a variable passed to the page.

 

I dont even see how you are getting the passengers unique email address?

 

There should be some kind of form on your page where the user supplies their email address which can be used to query the database.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 1
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

it's a very basic login form which the user first has to register with the following informaiton

First Name

Surname

Email

Mobile

Password

 

the user once registered, logs in with only email and password ... if entered correctly they then proceed to main menu after which they click the personal details button and that is the code i shared with you...

 

i really am grateful for your time and guidance on this... i am a total novice and this is my first time coding... all i have learn't has been via videos and tutorials...

 

are we allowed to chat on other platforms outside of this forum or is that not permitted? such as skype or via email

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

i changed that line

 

This:

$query_Information = "SELECT * FROM passenger";

 

Should be more like:

$query_Information = "SELECT * FROM passenger WHERE email = '$email'";

 

and i got this error message:-


Notice: Undefined variable: email in C:\xampp\htdocs\im_here\passtraveldetails.php on line 35

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
LEGEND ,
Jul 22, 2020

Copy link to clipboard

Copied

Sure you are going to get that Error Notice because you have no $email variable defined.

If you where to hard code an email address which is in your database:

 

$query_Information = "SELECT * FROM passenger WHERE email = 'someone@somewhere.com'";

 

and obviously target the right database column - so if you dont have an 'email' column in your database change the query to what your column name is and make sure its exactly the same, so if you have used uppercase in the database then use uppercase in the query etc.

 

$query_Information = "SELECT * FROM passenger WHERE myEmail = 'someone@somewhere.com'";

 

Then you will probably get something returned.

 

However you dont want to 'hard code' the email address you want your user to supply their email address, so they need a form for them to do so.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 1
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

are we able to chat on skype?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Community Beginner ,
Jul 22, 2020

Copy link to clipboard

Copied

I'm still getting errors, is it possible to chat over skype?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0
Adobe Community Professional ,
Jul 22, 2020

Copy link to clipboard

Copied

You need to do some homework before you can build web apps.  This is a public forum, not Adobe support.  For your own safety, do not reach out to strangers on Skype!!

 

=============
Beware of fake Adobe reps who may contact you privately offering to sell you software or take control of your computer.  It's a scam, run away! 

=============
3 Easy Ways to Identify Genuine Adobe Staff
https://tinyurl.com/10791730

 

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2020 0