I've tried doing the various 'alternating color row' methods that I found through a search of this site. If anyone can help me out, I'd appreciate it. Thanks!
I have a simple table with 2 columns here:
<!-- m --><a class="postlink" href="http://www.geology.ohio-state.edu/faculty_test.html">http://www.geology.ohio-state.edu/faculty_test.html</a><!-- m -->
I want 1 row to be a medium blue, and the next to be light blue. Right now, the light blue is only showing up. Here is my code:
<?php
$counter = 2;
$dbhost='localhost';
$username='x';
$pass='x';
$dbname='faculty';
$link_id=mysql_connect($db, $username, $pass) or DIE("Unable to connect to Server!");
$db=mysql_select_db("faculty", $link_id) or DIE("Unable to select database!");
$query="SELECT * FROM faculty";
$result=mysql_query($query);
while ($query_data=mysql_fetch_array($result)) {
$name=$query_data["name"];
$email=$query_data["email"];
$url=$query_data["url"];
if ($counter%2 == 0){
$color = "#EEEEFF";
}
else $color = "#99CCFF";
echo "<tr>\n";
echo "<td bgcolor=$color><a href=http://www.phpbuilder.com/board/archive/index.php/$url>$name</a></td>\n";
echo "<td bgcolor=$color><a href=mailto:$email>$email</a></td>\n";
echo "</tr>\n";
}
?>
I have a simple table with 2 columns here:
<!-- m --><a class="postlink" href="http://www.geology.ohio-state.edu/faculty_test.html">http://www.geology.ohio-state.edu/faculty_test.html</a><!-- m -->
I want 1 row to be a medium blue, and the next to be light blue. Right now, the light blue is only showing up. Here is my code:
<?php
$counter = 2;
$dbhost='localhost';
$username='x';
$pass='x';
$dbname='faculty';
$link_id=mysql_connect($db, $username, $pass) or DIE("Unable to connect to Server!");
$db=mysql_select_db("faculty", $link_id) or DIE("Unable to select database!");
$query="SELECT * FROM faculty";
$result=mysql_query($query);
while ($query_data=mysql_fetch_array($result)) {
$name=$query_data["name"];
$email=$query_data["email"];
$url=$query_data["url"];
if ($counter%2 == 0){
$color = "#EEEEFF";
}
else $color = "#99CCFF";
echo "<tr>\n";
echo "<td bgcolor=$color><a href=http://www.phpbuilder.com/board/archive/index.php/$url>$name</a></td>\n";
echo "<td bgcolor=$color><a href=mailto:$email>$email</a></td>\n";
echo "</tr>\n";
}
?>