0

hey guys,

I've been working on that moodle database link and I have it somewhat working!

I have it logging in and echoing the username. This is the login section:

  $query = "SELECT * FROM moodle_user WHERE username = '{$_POST['username']}' AND password = '$password'";
    $result = mysqli_query($con,$query) or die(mysqli_error($con));

    //setup row
    if ($_POST['submit']) {
        $Row = mysqli_fetch_assoc($result);
        $username = $_POST['username'];
        $firstname = $_Row['firstname'];
        $lastname = $_Row['lastname'];
        $name = print_r($_Row['firstname']);

    }



<div id="Header"><div class="user_details">

  <?php 
  if ($_POST['submit']) {
     echo 'Logged in as: ' . $username . '<br>';
     echo 'Your name: ' . $firstname;
    } else {
     echo 'Not logged in';
     }
   ?> 

The problem I am having is that the echo 'Your name: ' . $firstname;

isn't echoing anything. However I was able to echo the array earlier.

2
Contributors
2
Replies
16
Views
4 Years
Discussion Span
Last Post by bradly.spicer
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.