Can anyoine please help me with makeing the row color alternate. I have been stuck on this for a few days. I can get it to work with this code:
<?php
$connection = mysql_connect ("localhost", "root", "");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
} //end if
$query = "select * from westvaco Where district = '$district'";
$result = mysql_db_query ("db", $query);
if ($result){
echo "<table width=490 border=0 cellspacing=0 cellpadding=2 align=center>";
echo "<tr>
<td align=center><strong><u>Log File#</u></strong></td>
<td align=center><strong><u>District</u></strong></td>
<td align=center><strong><u>Tract Name</u></strong></td>
<td align=center><strong><u>Stand</u></strong></td>
<td align=center><strong><u>Acres</u></strong></td>
</tr>";
$numOfRows = mysql_num_rows ($result);
for ($i = 0; $i < $numOfRows; $i++){
$row_class = ($i % 2) ? 'Data1' : 'Data2';
$image = mysql_result ($result, $i, "image");
$log_file = mysql_result ($result, $i, "log_file");
$district = mysql_result ($result, $i, "district");
$tractname = mysql_result ($result, $i, "tract_name");
$stand = mysql_result ($result, $i, "stand");
$acres = mysql_result ($result, $i, "acres");
echo "<tr class=\"$row_class\">
<td><a href=$image class=image>$log_file</a></td>
<td>$district</td>
<td>$tractname</td>
<td>$stand</td>
<td>$acres</td>
</tr>";
$row_count ++;
} //end for
mysql_free_result($result);
echo "</table>";
} else {
echo "<p align=\"center\" style=\"font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;\">
Sorry, no records were found.
</p>";
} //end if
mysql_close($connection);
?>
BUT, with this new code that I am trying to use, I can not get it to work.
<?php
include "config.inc.php";
$offset = isset($GET['offset']) ? $GET['offset'] : 0;
$offsetOriginal = $offset;
$photoQueryResult = retrieve_album_page($offset);
$totalRows = mysql_numrows($photoQueryResult);
while ($row = mysql_fetch_array($photoQueryResult))
{
$photoID = $row['photoID'];
$photoFileName = $row['photoFileName'];
$log_file = $row['log_file'];
$district = $row['district'];
$tract_name = $row['tract_name'];
$stand = $row['stand'];
$acres = $row['acres'];
echo "<table width='500' border='0' cellspacing='0' cellpadding='0' align='center'>
<tr>
<td width='100'>
<p align='left' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 15pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;'>
<a href='map.php?photoID=$photoID&offset=$offsetOriginal' class='image'>$log_file</a>
</p>
</td>
<td width='100'>
<p align='left' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 15pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;'>
$district
</p>
</td>
<td width='150'>
<p align='left' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 15pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;'>
$tract_name
</p>
</td>
<td width='75'>
<p align='left' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 15pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;'>
$stand
</p>
</td>
<td width='75'>
<p align='left' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin-bottom: 0pt; margin-left: 15pt; margin-right: 0pt; margin-top: 10pt; color: #000000; font-size: 10pt;'>
$acres
</p>
</td>
</tr>
<tr><td colspan='5'><img src='../images/ltblue_pix.gif' alt='' width='480' height='1' border='0'></td></tr>
</table>";
$offset++;
}
echo "<div><p>";
echo previous_page($offset, $totalRows);
echo " | ";
echo next_page($offset);
echo "</p></div>";
?>
Any help would be greatful!