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.

Recommended Answers

All 2 Replies

Silly me! Thanks prit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.