Hejsa
En af mine venner har lavet en tabel til mig, men jeg vil gerne have at hver anden række har en anden farve, da det vil være nemmere at bevare overblikket så.
Problemet er blot at jeg ikke aner hvordan man gør :-(
Jeg indsætter hele sidens kode.
<?php require_once('Connections/ThuleAB.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_rsThule = 10;
$pageNum_rsThule = 0;
if (isset($_GET['pageNum_rsThule'])) {
$pageNum_rsThule = $_GET['pageNum_rsThule'];
}
$startRow_rsThule = $pageNum_rsThule * $maxRows_rsThule;
mysql_select_db($database_ThuleAB, $ThuleAB);
$query_rsThule = "SELECT * FROM thule";
$query_limit_rsThule = sprintf("%s LIMIT %d, %d", $query_rsThule, $startRow_rsThule, $maxRows_rsThule);
$rsThule = mysql_query($query_limit_rsThule, $ThuleAB) or die(mysql_error());
$row_rsThule = mysql_fetch_assoc($rsThule);
if (isset($_GET['totalRows_rsThule'])) {
$totalRows_rsThule = $_GET['totalRows_rsThule'];
} else {
$all_rsThule = mysql_query($query_rsThule);
$totalRows_rsThule = mysql_num_rows($all_rsThule);
}
$totalPages_rsThule = ceil($totalRows_rsThule/$maxRows_rsThule)-1;
$queryString_rsThule = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsThule") == false &&
stristr($param, "totalRows_rsThule") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsThule = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsThule = sprintf("&totalRows_rsThule=%d%s", $totalRows_rsThule, $queryString_rsThule);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="Generator" content="Stone's WebWriter 4">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Vis brugere</title>
</head>
<body>
<center>
<form name="form" method="GET" action="Resultat.php">
Søgeord: <input name="find" value="" size="30">
<input name="Submit" type="submit" value="Søg">
</form>
<table width="98%" border="1" cellpadding="3" cellspacing="3">
<tr>
<td>id</td>
<td>Name</td>
<td>Workplace</td>
<td>Year</td>
<td>Dorm</td>
<td>email</td>
<td>view</td>
<td>edit</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_rsThule['id']; ?></td>
<td><?php echo $row_rsThule['Name']; ?></td>
<td><?php echo $row_rsThule['Workplace']; ?></td>
<td><?php echo $row_rsThule['Year']; ?></td>
<td><?php echo $row_rsThule['Dorm']; ?></td>
<td><a href="mailto:<?php echo $row_rsThule['email']; ?>"><?php echo $row_rsThule['email']; ?></a><td><!a href="VisEnkelt.php?id=<?php echo $row_rsThule['id']; ?>" title="Vis 1 bruger" target="_self"> </a></td><td><!a href="RetThule.php?id=<?php echo $row_rsThule['id']; ?>" title="Ret valgte bruger" target="_self"></a></td></td>
</tr>
<?php } while ($row_rsThule = mysql_fetch_assoc($rsThule)); ?>
</table>
</center>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_rsThule > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsThule=%d%s", $currentPage, 0, $queryString_rsThule); ?>">First</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_rsThule > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsThule=%d%s", $currentPage, max(0, $pageNum_rsThule - 1), $queryString_rsThule); ?>">Previous</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_rsThule < $totalPages_rsThule) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsThule=%d%s", $currentPage, min($totalPages_rsThule, $pageNum_rsThule + 1), $queryString_rsThule); ?>">Next</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_rsThule < $totalPages_rsThule) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsThule=%d%s", $currentPage, $totalPages_rsThule, $queryString_rsThule); ?>">Last</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
</body>
</html>
Siden kan ses her
http://www.thuleab.dk/nythule/VisThule.phpwww.thuleab.dk
\\"The Ultimate Guide to Thule Air Base\\"