0

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!

2
Contributors
2
Replies
18
Views
4 Years
Discussion Span
Last Post by LauraLemana
0

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

Edited by happygeek: spam deleted

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.