WEB-NES-BAY

Learn Tips and tricks on Linux, Hacking, linux, PHP, Perl, Web, Hardware

bookmark bookmark
Posted by WEBNESBAY ADD COMMENTS

Most of the websites use this alternating color to tables which will make the user readability of table content. We can use any of the colors you want.
I am writing php code which will print the data present in the mysql table in a alternating color format.
<?php
//Database Connection inputs
$host=”localhost”; // Host name
$username=””; // Mysql username
$password=””; // Mysql password
$database=”mydb”; // Database name
$table=”mytable”; // Table name
// Connect to server and select databse
mysql_connect(“$host”, “$username”, “$password”)or die(“cannot connect”);
mysql_select_db(“$mydb”)or die(“cannot select DB”);
$sql=”SELECT * FROM $mytable”;
$result=mysql_query($sql);
// [...]

Categories: PHP