MySQL Display
Posted: Sat Jun 10, 2006 5:10 pm
Can someone tell me how to make this code display alternate row colors and add a table border?
Code: Select all
<?
$username="";
$password="";
$database="";
mysql_connect("",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query("SELECT * FROM contact");
echo "<table>";
echo "<tr> <th>ID No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email Address</th>
<th>Phone Number</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip Code</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr><td>";
echo $row['id'];
echo "</td><td>";
echo $row['FirstName'];
echo "</td><td>";
echo $row['LastName'];
echo "</td><td>";
echo $row['Email'];
echo "</td><td>";
echo $row['Phone'];
echo "</td><td>";
echo $row['Address'];
echo "</td><td>";
echo $row['City'];
echo "</td><td>";
echo $row['State'];
echo "</td><td>";
echo $row['Zip'];
echo "</td><tr>";
}
echo "</table>";
?>