Popo
Popo

Reputation: 15

Changing the font colour of data from database

Im still a beginner and i want to change the font colour.

echo "<tr><td>" . $count . "</td><td>" . $row['c_name'] . "</td><td>" . $row['invoice_number'] . "</td><td>" . date("d-m-Y", strtotime($row['purchase_date'])) . "</td>";

i want it to be white instead of gray which is the default. The output is from database.

Upvotes: 0

Views: 67

Answers (2)

Dupinder Singh
Dupinder Singh

Reputation: 7789

this is simple just

One way: add inline style where you want like $cname is coming from database then add inline style

<?php
$count = 10;
$cname = "Dupinder";

echo "<table><tr><td >" . $count . "</td><td style='color: red'>" . $cname . "</td></tr></table>";

?>

Second way: create a css class

.dataDataBase
{
  color: red;
}

and add class to thode TD which contains data from database :)

echo "<tr><td>" . $count . "</td><td class='dataDataBase'>" . $row['c_name'] . "</td><td class='dataDataBase'>" . $row['invoice_number'] . "</td><td class='dataDataBase'>" . date("d-m-Y", strtotime($row['purchase_date'])) . "</td>";

this should work fine

Upvotes: 0

Lea M.
Lea M.

Reputation: 11

If you already have a CSS file you would need to add this for the right HTML tag:

td {
    color : white;
}

Or as an alternative you could add this to your php:

<td style="color:white;">

I used the td as an example, you will have to apply this to the one you need.

Upvotes: 1

Related Questions