Functions Php



Alternating Row Colors



// Connect to MySQL
mysql_connect ('localhost', 'username', 'password')
or die ("Can't connet to MySQL server.");
mysql_select_db ('dbname');
$result = mysql_query (SELECT * FROM table);
if ($row = mysql_fetch_array($result)) {
for ($i = 0; i < count($row); $i++) {
// Set Table Row Color
if ($i % 2) {
echo "";
} else {
echo "";
}
// Now display our table cell info
?>


} else {
echo "";
}
?>
Sorry, no records were found!