fischkrampf
Mitglied
Hi,
ich schreibe gerade eine Datenbank in PHP, die Movies verwaltet. Die Datei index.php soll alle eingetragenen Movies in einer HTML-Tabelle auflisten. Leider bleiben aber die Zellen leer. Jedoch hat die Tabelle so viele Zeilen, wie es Datensätze in der MYSQL-Tabelle gibt. Ich weiss nicht wo da das Problem sein könnte...
Vielen Dank für eure Hilfe!!!!
Hier der Code:
ich schreibe gerade eine Datenbank in PHP, die Movies verwaltet. Die Datei index.php soll alle eingetragenen Movies in einer HTML-Tabelle auflisten. Leider bleiben aber die Zellen leer. Jedoch hat die Tabelle so viele Zeilen, wie es Datensätze in der MYSQL-Tabelle gibt. Ich weiss nicht wo da das Problem sein könnte...
Vielen Dank für eure Hilfe!!!!
Hier der Code:
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<?php
$owner = "fischkrampf";
$server = "localhost";
$user = "root";
$pass = "";
if((!$connection = mysql_connect($server, $user, $pass)))
echo "Konnte nicht mit der Datenbank verbinden!";
if(!(mysql_select_db("fischkrampf", $connection)))
echo "Konnte nicht mit der Datenbank verbinden!";
?>
<head>
<STYLE TYPE="text/css">
body {
font-family: Arial;
font-size : 15px;
}
a {
text-decoration : underline;
color : Black;
font-size : 16px;
}
td {
}
th {
font-weight : normal;
border-top : 1px dotted #616980;
border-bottom : 1px dotted #616980;
}
</STYLE>
<title>Movie Datenbank von <?php echo $owner ?></title>
</head>
<body>
<div style="color: Navy; font-size:19px; text-align: center;">Movie Datenbank von <?php echo $owner ?></div>
<br><br><br>
<form action="mail.php" method="post">
<table border="0" align="center" cellspacing="4" cellpadding="2">
<tr bgcolor="#e3ecf0" style="font-size: 16px; color: Navy;">
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="8%"><a href="#">Bestellen</a></td>
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="30%"><a href="<?php echo "$PHP_SELF?sort=name"; ?>">Filmname</a></td>
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="25%"><a href="<?php echo "$PHP_SELF?sort=genre"; ?>">Genre</a></td>
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="10%"><a href="<?php echo "$PHP_SELF?sort=laenge"; ?>">Länge</a></td>
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="10%"><a href="<?php echo "$PHP_SELF?sort=sprache"; ?>">Sprache</a></td>
<th align="center" onMouseOver="this.style.backgroundColor='#9abad1'" onMouseOut="this.style.backgroundColor='#e3ecf0'" width="10%"><a href="<?php echo "$PHP_SELF?sort=groesse"; ?>">Anzahl CD's</a></td>
</tr>
<?php
$result = mysql_query("SELECT * FROM movies", $connection);
$bg = 1;
while ($row = mysql_fetch_array($result) && $result) {
if ($bg == 1) {
echo "<tr style='background: #E4E4E4;'><td align='center'>";
$bg = 0;
}
else {
echo "<tr style='background: Silver;'><td align='center'>";
$bg = 1;
}
echo "<input type=\"checkbox\" name=\"bestellen[]\" value=\"$row[0]\"></td><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td></tr>\n";
}
?>
</table>
<br><br><br><hr><br>
<table border="0" cellspacing="2" cellpadding="2" bgcolor="#EEEEEE">
<tr>
<td width="10%">Name</td>
<td align="center"><input type="text" name="name"></td>
<td width="80%" align="center"></td>
</tr>
<tr>
<td width="10%">E-Mail Adresse</td>
<td><input type="text" name="eMail"></td>
<td width="80%"></td>
</tr>
<tr>
<td colspan="3"><br><input alt="Submit" type="submit" value="Anfrage senden" /><img src="pixel.gif" alt="Spacer" width="20" height="1" border="0"><input alt="Reset" type="reset" value="Formular löschen" /></td>
<td></td>
<td width="80%"></td>
</tr>
</table>
</form>
</body>
</html>