I have a hex color set inside of a table column and trying to set it to a div background but it will not apply it:
<?php
$user = $_SESSION['user'];
try{
$results = $dbh->query("SELECT *
FROM cat_List
INNER JOIN user_cat_link_table
ON cat_List.Cat_ID = user_cat_link_table.Cat_ID
WHERE user_cat_link_table.UserID = $user");
}catch(Exception $e) {
echo $e->getMessage();
die();
}
$docs = $results->fetchAll(PDO::FETCH_ASSOC);
foreach($docs as $docs){
echo '
<a href="catView.php?cat_id='.$docs["cat_id"].'">
<div class="indexBox" style="background-color="'.$docs["cat_color"].'">
<div class="indexBoxHeader">
<i class="fa fa-users" style="font-size: 2em;"></i></div>
<div class="indexBoxFooter">
<p>'.$docs["cat_title"].'</p>
</div>
</div>
</a>
';}
?>
If I echo the cat_color out it return the value #000 which is the value in the table? Is my syntax wrong?
It should be style="background-color:'.$docs["cat_color"].'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With