0

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";
}
2
Contributors
1
Reply
9
Views
1 Year
Discussion Span
Last Post by radow
0

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

$sql = "SELECT * FROM accounts WHERE username = '$testuser'";

Edited by radow

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.