Just a quick question really,

I'm using a database which is for Moodle, and I want to extract the login details for an Android app I am writing so they can login to that database and See their information.

Part of it is in PHP... so it's Java > PHP > Android.

<?php

require_once 'include/config.php';

//Values
    $username_in = $_POST['username'];
    $password_in = $_POST['password'];

    $query = "SELECT * from moodle_user where username ='".$username_in."' AND password = '".$password_in."'";
    $query_exec = mysqli_query($con, $query) or die(mysqli_error($con));

//if and else

    $rows = mysqli_num_rows($query_exec);
    if($rows == 0) {
        echo "No users found";
        mysqli_fetch_row ($con,$query);
    } else {
        echo "Found user: " . $username_in;
    }

        //Make your query and store it in $result

        while ($rows = mysql_fetch_assoc($query_exec))
        {
           echo "usernames: " . $rows['username'];
        }


?>

I know for a fact that it is populated: http://prntscr.com/149dvu
I'm just wondering why it says it's connected but cannot grab the information..

Thanks guys.

P.s

I know I know it's procedural :P I'm sorry!

Fixed: I didn't validate what the username was, so how could I have tested it?! Duhhh

I am still in a fix for propagated functions..How can I derive and use it? It is basically one of the difficult concept.

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.