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">

  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

You are mixing $Row and $_Row

Jump to Post

All 2 Replies

You are mixing $Row and $_Row

Silly me! Thanks prit

Be a part of the DaniWeb community

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