PHP MYSQL Cant get user data to pull from database, only id and name [closed]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I cant seem to get any of my users other information pulled from the database other than their username and ID and im not understanding why, heres my code trying to call it from session.



// Now we check if the data was submitted, isset will check if the data exists.
if ( !isset($_POST['username'], $_POST['password']) ) {
// Could not get the data that should have been sent.
die ('Username and/or password does not exist!');
}
// Prepare our SQL
if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
// Bind parameters (s = string, i = int, b = blob, etc), hash the password using the PHP password_hash function.
$stmt->bind_param('s', $_POST['username']);
$stmt->execute();
$stmt->store_result();
// Store the result so we can check if the account exists in the database.
if ($stmt->num_rows > 0) {
$stmt->bind_result($id, $password);
$stmt->fetch();
// Account exists, now we verify the password.
if (password_verify($_POST['password'], $password)) {
// Verification success! User has loggedin!
$_SESSION['loggedin'] = TRUE;
$_SESSION['username'] = $_POST['username'];
$_SESSION['id'] = $id;
$_SESSION['title'] = $title;
$_SESSION['website'] = $website;
$_SESSION['youtube'] = $youtube;
$_SESSION['facebook'] = $facebook;
$_SESSION['paypalemail'] = $paypalemail;
echo 'Welcome ' . $_SESSION['username'] . '!';
echo 'Welcome ' . $_SESSION['title'] . '!';
echo'<a href="/profile.php">My Profile </a>';
} else {
echo 'Incorrect username and/or password!';
}
} else {
echo 'Incorrect username and/or password!';
}
$stmt->close();
} else {
echo 'Could not prepare statement!';
}
?>









share|improve this question













closed as off-topic by Tetsujin, fixer1234, Toto, music2myear, bertieb Jan 30 at 19:30


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about computer hardware or software, within the scope defined in the help center." – Tetsujin, fixer1234, music2myear, bertieb

If this question can be reworded to fit the rules in the help center, please edit the question.























    0















    I cant seem to get any of my users other information pulled from the database other than their username and ID and im not understanding why, heres my code trying to call it from session.



    // Now we check if the data was submitted, isset will check if the data exists.
    if ( !isset($_POST['username'], $_POST['password']) ) {
    // Could not get the data that should have been sent.
    die ('Username and/or password does not exist!');
    }
    // Prepare our SQL
    if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
    // Bind parameters (s = string, i = int, b = blob, etc), hash the password using the PHP password_hash function.
    $stmt->bind_param('s', $_POST['username']);
    $stmt->execute();
    $stmt->store_result();
    // Store the result so we can check if the account exists in the database.
    if ($stmt->num_rows > 0) {
    $stmt->bind_result($id, $password);
    $stmt->fetch();
    // Account exists, now we verify the password.
    if (password_verify($_POST['password'], $password)) {
    // Verification success! User has loggedin!
    $_SESSION['loggedin'] = TRUE;
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['id'] = $id;
    $_SESSION['title'] = $title;
    $_SESSION['website'] = $website;
    $_SESSION['youtube'] = $youtube;
    $_SESSION['facebook'] = $facebook;
    $_SESSION['paypalemail'] = $paypalemail;
    echo 'Welcome ' . $_SESSION['username'] . '!';
    echo 'Welcome ' . $_SESSION['title'] . '!';
    echo'<a href="/profile.php">My Profile </a>';
    } else {
    echo 'Incorrect username and/or password!';
    }
    } else {
    echo 'Incorrect username and/or password!';
    }
    $stmt->close();
    } else {
    echo 'Could not prepare statement!';
    }
    ?>









    share|improve this question













    closed as off-topic by Tetsujin, fixer1234, Toto, music2myear, bertieb Jan 30 at 19:30


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "This question is not about computer hardware or software, within the scope defined in the help center." – Tetsujin, fixer1234, music2myear, bertieb

    If this question can be reworded to fit the rules in the help center, please edit the question.



















      0












      0








      0








      I cant seem to get any of my users other information pulled from the database other than their username and ID and im not understanding why, heres my code trying to call it from session.



      // Now we check if the data was submitted, isset will check if the data exists.
      if ( !isset($_POST['username'], $_POST['password']) ) {
      // Could not get the data that should have been sent.
      die ('Username and/or password does not exist!');
      }
      // Prepare our SQL
      if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
      // Bind parameters (s = string, i = int, b = blob, etc), hash the password using the PHP password_hash function.
      $stmt->bind_param('s', $_POST['username']);
      $stmt->execute();
      $stmt->store_result();
      // Store the result so we can check if the account exists in the database.
      if ($stmt->num_rows > 0) {
      $stmt->bind_result($id, $password);
      $stmt->fetch();
      // Account exists, now we verify the password.
      if (password_verify($_POST['password'], $password)) {
      // Verification success! User has loggedin!
      $_SESSION['loggedin'] = TRUE;
      $_SESSION['username'] = $_POST['username'];
      $_SESSION['id'] = $id;
      $_SESSION['title'] = $title;
      $_SESSION['website'] = $website;
      $_SESSION['youtube'] = $youtube;
      $_SESSION['facebook'] = $facebook;
      $_SESSION['paypalemail'] = $paypalemail;
      echo 'Welcome ' . $_SESSION['username'] . '!';
      echo 'Welcome ' . $_SESSION['title'] . '!';
      echo'<a href="/profile.php">My Profile </a>';
      } else {
      echo 'Incorrect username and/or password!';
      }
      } else {
      echo 'Incorrect username and/or password!';
      }
      $stmt->close();
      } else {
      echo 'Could not prepare statement!';
      }
      ?>









      share|improve this question














      I cant seem to get any of my users other information pulled from the database other than their username and ID and im not understanding why, heres my code trying to call it from session.



      // Now we check if the data was submitted, isset will check if the data exists.
      if ( !isset($_POST['username'], $_POST['password']) ) {
      // Could not get the data that should have been sent.
      die ('Username and/or password does not exist!');
      }
      // Prepare our SQL
      if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
      // Bind parameters (s = string, i = int, b = blob, etc), hash the password using the PHP password_hash function.
      $stmt->bind_param('s', $_POST['username']);
      $stmt->execute();
      $stmt->store_result();
      // Store the result so we can check if the account exists in the database.
      if ($stmt->num_rows > 0) {
      $stmt->bind_result($id, $password);
      $stmt->fetch();
      // Account exists, now we verify the password.
      if (password_verify($_POST['password'], $password)) {
      // Verification success! User has loggedin!
      $_SESSION['loggedin'] = TRUE;
      $_SESSION['username'] = $_POST['username'];
      $_SESSION['id'] = $id;
      $_SESSION['title'] = $title;
      $_SESSION['website'] = $website;
      $_SESSION['youtube'] = $youtube;
      $_SESSION['facebook'] = $facebook;
      $_SESSION['paypalemail'] = $paypalemail;
      echo 'Welcome ' . $_SESSION['username'] . '!';
      echo 'Welcome ' . $_SESSION['title'] . '!';
      echo'<a href="/profile.php">My Profile </a>';
      } else {
      echo 'Incorrect username and/or password!';
      }
      } else {
      echo 'Incorrect username and/or password!';
      }
      $stmt->close();
      } else {
      echo 'Could not prepare statement!';
      }
      ?>






      php mysql database






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 29 at 9:19









      Sebastian ShearerSebastian Shearer

      31




      31




      closed as off-topic by Tetsujin, fixer1234, Toto, music2myear, bertieb Jan 30 at 19:30


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is not about computer hardware or software, within the scope defined in the help center." – Tetsujin, fixer1234, music2myear, bertieb

      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by Tetsujin, fixer1234, Toto, music2myear, bertieb Jan 30 at 19:30


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is not about computer hardware or software, within the scope defined in the help center." – Tetsujin, fixer1234, music2myear, bertieb

      If this question can be reworded to fit the rules in the help center, please edit the question.






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Where are the variables $title,$website,$youtube,$facebook,$paypalemail coming from? If they are stored in the accounts table with the same column names as the variable names you used you need to retrieve them along with the id and password.



          Change



          if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {


          to



          if ($stmt = $con->prepare('SELECT 
          `id`,
          `password`,
          `title`,
          `website`,
          `youtube`,
          `facebook`,
          `paypalemail`
          FROM accounts WHERE username = ?')) {





          share|improve this answer
























          • Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

            – Sebastian Shearer
            Jan 29 at 22:21


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Where are the variables $title,$website,$youtube,$facebook,$paypalemail coming from? If they are stored in the accounts table with the same column names as the variable names you used you need to retrieve them along with the id and password.



          Change



          if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {


          to



          if ($stmt = $con->prepare('SELECT 
          `id`,
          `password`,
          `title`,
          `website`,
          `youtube`,
          `facebook`,
          `paypalemail`
          FROM accounts WHERE username = ?')) {





          share|improve this answer
























          • Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

            – Sebastian Shearer
            Jan 29 at 22:21
















          1














          Where are the variables $title,$website,$youtube,$facebook,$paypalemail coming from? If they are stored in the accounts table with the same column names as the variable names you used you need to retrieve them along with the id and password.



          Change



          if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {


          to



          if ($stmt = $con->prepare('SELECT 
          `id`,
          `password`,
          `title`,
          `website`,
          `youtube`,
          `facebook`,
          `paypalemail`
          FROM accounts WHERE username = ?')) {





          share|improve this answer
























          • Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

            – Sebastian Shearer
            Jan 29 at 22:21














          1












          1








          1







          Where are the variables $title,$website,$youtube,$facebook,$paypalemail coming from? If they are stored in the accounts table with the same column names as the variable names you used you need to retrieve them along with the id and password.



          Change



          if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {


          to



          if ($stmt = $con->prepare('SELECT 
          `id`,
          `password`,
          `title`,
          `website`,
          `youtube`,
          `facebook`,
          `paypalemail`
          FROM accounts WHERE username = ?')) {





          share|improve this answer













          Where are the variables $title,$website,$youtube,$facebook,$paypalemail coming from? If they are stored in the accounts table with the same column names as the variable names you used you need to retrieve them along with the id and password.



          Change



          if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {


          to



          if ($stmt = $con->prepare('SELECT 
          `id`,
          `password`,
          `title`,
          `website`,
          `youtube`,
          `facebook`,
          `paypalemail`
          FROM accounts WHERE username = ?')) {






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 29 at 13:06









          DaveDave

          21227




          21227













          • Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

            – Sebastian Shearer
            Jan 29 at 22:21



















          • Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

            – Sebastian Shearer
            Jan 29 at 22:21

















          Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

          – Sebastian Shearer
          Jan 29 at 22:21





          Thank you! Yes they are in the databse and I attempted to add them their to no prevail but this looks exactly what I was wanting thank you sir!

          – Sebastian Shearer
          Jan 29 at 22:21



          Popular posts from this blog

          If I really need a card on my start hand, how many mulligans make sense? [duplicate]

          Alcedinidae

          Can an atomic nucleus contain both particles and antiparticles? [duplicate]