Onbekend |
|
Mijn eerst "probeersel" in php/mysql (er zullen vast veel fouten inzitten )
Alles word uit de mysql database gehaald, alleen de 1e rij word in een (html) tabel gezet. While zorgt ervoor dat iets herhaalt (een lus) dus lijkt me dat iets daar niet goed zit, maar wat ?
http://www.sneldesign.com/phpshit/wars.php
<?php
include 'config.php';
?>
<html>
<head>
<title><?php echo "$titel"; ?></title>
</head>
<body>
<table border="1" width="43%" cellspacing="0" cellpadding="0" bgcolor="#808080">
<tr>
<td width="33%" align="center">Clan</td>
<td width="33%" align="center">Enemy</td>
<td width="33%" align="center">Score</td>
</tr>
<?php
$res = mysql_query("SELECT clan,enemy,score FROM wars") or die (mysql_error());
while ($obj = mysql_fetch_object($res)) {
?>
<tr>
<td width="33%" bgcolor="#C0C0C0">
<?php echo $obj->clan." "; ?>
</td>
<td width="33%" bgcolor="#C0C0C0">
<?php echo $obj->enemy." "; ?>
</td>
<td width="34%" bgcolor="#C0C0C0">
<p align="center">
<?php echo $obj->score." "; ?>
</td>
</tr>
</table>
<?php
}
mysql_free_result($res);
?>
</body>
</html>
<?php include 'config.php'; ?> <html> <head> <title> <?php echo "$titel"; ?></title> </head> <body> <table border="1" width="43%" cellspacing="0" cellpadding="0" bgcolor="#808080"> <tr> <td width="33%" align="center">Clan</td> <td width="33%" align="center">Enemy</td> <td width="33%" align="center">Score</td> </tr> <?php ?> <tr> <td width="33%" bgcolor="#C0C0C0"> <?php echo $obj->clan." "; ?> </td> <td width="33%" bgcolor="#C0C0C0"> <?php echo $obj->enemy." "; ?> </td> <td width="34%" bgcolor="#C0C0C0"> <p align="center"> <?php echo $obj->score." "; ?> </td> </tr> </table> <?php } ?> </body> </html>
|