code:
$tables = array("action", "adventure");
foreach ($tables AS $table) {
$sql = "SELECT game, url FROM $table
WHERE gamesystem='playstation'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
// for convenience I use the function extract() to place
// each element (result set field) contained in $row
// into its own variable; ie, $game, $url
extract($row);
// Now insert into the array $games the key/value pair $game/$url
$games["$game"] = $url;
}
}
// now sort the array by its keys
ksort($games);
echo '<table>';
while (list ($key, $val) = each ($games)) {
echo "<tr><td><a href='$val'>$key</a></td></tr>";
}
echo '</table>';
Is it possible to have the output have alternating table colours for the next data
Example:
<tr><td bgcolor="#111111><a href='$val'>$key</a></td></tr>
followed by
<tr><td bgcolor="#222222"><a href='$val'>$key</a></td></tr>
and it goes on repeating. Possible?





Bookmarks