Probably just overlooking something small but its 5:30 am here so please forgive me.

$sql = "SELECT * FROM accounts WHERE username = $testuser";
$result = mysqli_query($conn, $sql);

if (!$result || mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "id: " . $row["id"]. " - Name: " . $row["username"]. " " . $row["password"]. "<br>";
    }
} else {
    echo "0 results";
}

This variable "$testuser" have to be inside quotes.

$sql = "SELECT * FROM accounts WHERE username = '$testuser'";
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.