Problem: I am learning PHP and I cant figure out how to display all rows in my table. Right now it only shows the info from which the user logged in. I am not sure how where to start or how to do this. I know while loops could be helpful but not sure how to use it in this context. Im pretty new to all this.
What I Tried
I removed the LIMIT and added echo *$row->username, $row->username.
<?php
$verbindung = mysql_connect("localhost", "social" , "123")
or die("cant connect");
mysql_select_db("homepage") or die ("cant connect to database");
$username = $_POST["username"];
$passwort = md5($_POST["password"]);
$abfrage = "SELECT username, password FROM login WHERE username LIKE '$username'";
$ergebnis = mysql_query($abfrage);
$row = mysql_fetch_object($ergebnis);
if($row->password == $passwort)
{
$_SESSION["username"] = $username;
echo $row->username, $row->username;
}
else
{
echo "Something went wrong>";
}
?>
Conclusion
What am I missing our / doing wrong? I Would appreciate if you could show me how its done with some thorough explanations if possible.