Question: For my PHP/MYSQL code , how do I assign certain images and colours to certain values of database arrays in my code below. For example
For my PHP/MYSQL code , how do I assign certain images and colours to certain values of database arrays in my code below. For example the colour red to the name text of "John" and green for "Mary" from Person_Name and a American flag to "New York!" and a French flag to "Paris" from City_Name?
Code is below
/* style rule for the class Databasetable */
.Databasetable {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 66%;
}
/* style rule for table cells */
.Databasetable td, .Databasetable th {
border: 6px solid #ddd;
padding: 14px;
}
/* style rule for even row */
.Databasetable tr:nth-child(even){background-color: #f1f1f1;}
.Databasetable tr:hover {background-color: #fff;}
.Databasetable th {
padding-top: 20px;
padding-bottom: 20px;
text-align: left;
background-color: grey;
color: white;
}
$user='root';
$pass='';
$host='localhost';
$db='MyDatabase';
$conn=mysqli_connect($host,$user,$pass,$db);//connect to the server
$result=mysqli_query($conn,"select * from City");
?>
| ID | Name |
|---|---|
//fetch Person table records
$result=mysqli_query ($conn,'select * from Person');
?>
| ID | Name |
|---|---|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
