How do I inlinestyle variables and free tekst within PHPtags

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
Morris 2
Forum Newbie
Posts: 1
Joined: Tue Oct 04, 2011 5:04 am

How do I inlinestyle variables and free tekst within PHPtags

Post 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
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

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

Post 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";
}
?>
Post Reply