Page 1 of 1

How do I inlinestyle variables and free tekst within PHPtags

Posted: Tue Oct 04, 2011 5:16 am
by Morris 2
Hi.

I have this working PHP script.
I want to inline style the variable and the tekst in bold and red.

How do I do this? It seems to be a bit different than in normal HTML.

Code: Select all

<?php
  
$chart = mysql_query("SELECT * FROM Hitlist ORDER BY total DESC limit 5"); 
$num_rows = mysql_num_rows($chart);
      
while($row = mysql_fetch_assoc($chart))
{echo $row['artist']." ... "
 .$row['city']." ("
 .$row['country'].") "
 .$row[[b][color=#FF0000]'total'[/color][/b]]." [b][color=#FF0000]USD[/color][/b] <br>";}

?>
Regards Morris

Re: How do I inlinestyle variables and free tekst within PHP

Posted: Wed Nov 02, 2011 2:08 pm
by icesolid
Add this class to your CSS file if you have one, or just use this declaration below, then call the class in a SPAN tag, like so:

Code: Select all

<style type="text/css">
.make-bold-red {
    font-weight: bold;
    color: #FF0000;
}
</style>

<?php
$chart = mysql_query("SELECT * FROM Hitlist ORDER BY total DESC limit 5"); 
$num_rows = mysql_num_rows($chart);

while($row = mysql_fetch_assoc($chart)) {
    echo $row['artist'] . ' ... ' . $row['city'] . ' (' . $row['country'] . ') <span class="make-bold-red">' . $row['total'] . ' USD</span><br />' . "\n";
}
?>