[PHP & MySQL] PHP Fehler!

Caro15
Ich habe einen Code zur Abfrage des Usernamen erstellt, jedoch funktioniert es irgendwie nicht, vielleicht kann mit ja jemand helfen?
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
<?
@session_start();
$username = $_SESSION["username"];
$pass = $_SESSION["password"];
include("db.php");
?> 
 <?php
  $abfrage "SELECT username FROM users";
  $ergebnis mysql_query($abfrage);
  while($row mysql_fetch_object($ergebnis))
    {
    echo $row->username;
    }
  ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>RZ Immenh&ouml;fe</title>
</head>
<body>
</body>
</html>


Es kommt die Meldung: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /usr/export/www/vhosts/funnetwork/hosting/tschampion/2/Eigene Dateien.php on line 10
Maina
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
<?
@session_start();
$username = $_SESSION['username'];
$pass = $_SESSION['password'];
include("db.php");
?> 
 <?php
  $abfrage "SELECT * FROM users";
  $ergebnis mysql_query($abfrage);
  while($row mysql_fetch_object($ergebnis))
    {
    echo $row->username;
    }
  ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>RZ Immenh&ouml;fe</title>
</head>
<body>
</body>
</html>


Vielleicht so?

Weiß aber auch nich genau...
Jessie
Bis du sicher das in der Datenbank alles richtig ist, also das die Spalte auch vorhanden ist? Das hatte ich nämlich x3
Caro15
Also der Code stimmt jetzt, nur ich weiß nicht, wie ich das mach, dass nur der Name von dem, der Eingeloggt ist angezeigt wird, denn es zeigt mir alle Namen an!

php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<?
@session_start();
$user = $_SESSION['user'];
$pass = $_SESSION['pass'];
include('db.php');
  $abfrage = "SELECT * FROM users";
  $ergebnis = mysql_query($abfrage);
  while($row = mysql_fetch_object($ergebnis))
    {
    echo $row->user;
    }
  ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>RZ Immenh&ouml;fe</title>
</head>
<body>
</body>
</html>
Caro15
Ok Danke, jetzt stimmt es , aber jetzt kommt die ganze Zeit

NacappaNacappaNacappaNacappaNacappaNacappaNacappa
NacappaNacappaNacappaNacappaNacappaNacappa
NacappaNacappaNacappaNacappa
Caro15
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<?
@session_start();
$user = $_SESSION['user'];
$pass = $_SESSION['pass'];
include('db.php');
  $abfrage = "SELECT * FROM users";
  $ergebnis = mysql_query($abfrage);
  while($row = mysql_fetch_object($ergebnis))
    {
    echo $user;
    }
  ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>RZ Immenh&ouml;fe</title>
</head>
<body>
</body>
</html>