// Displays alternate table row colors
function row_color($i){
$bg1 = "#0099FF"; // color one
$bg2 = "#336699"; // color two
if ( $i%2 ) {
return $bg1;
} else {
return $bg2;
}
}
//DB connection
$connection = mysql_connect("localhost","userName","password");
$db = mysql_select_db("databaseName");
$sql = "select * from tableName"; // Database Query
$result = mysql_query("$sql"); // Database Query result
// Starts the table
echo "\n";
// Create the contents of the table.
for( $i = 0; $i < $row = mysql_fetch_array($result); $i++){
echo "\n"
."".$row["fname"]." \n"
."".$row["lname"]." \n"
." ";
}
echo "
"
?>