Jump to content

How to color code certain words of PHP database output?


vbcoach

Recommended Posts

Hello.  Racking my brains here, having trouble with this.  Running a sports league, trying to get the output of one variable at a different font color OR insert a simple check mark graphic.  Either way I am stuck.  I am a bit out of practice here.

 

Here is the code.  Where is says echo (  Locked) is where I would like to either have locked in a color, say green or red - or insert check mark symbol.

<?php
	$last  = -1;
        while($team = mssql_fetch_assoc($res))
	{
	  if ($last  != $team['l_id'])
	  {
	    $last  = $team['l_id'];
		echo "<br><span class=\"dk_greyTxt\" style=\"font-size: 14px\"><strong>$team[night] night, $team[type] $team[size]s $team[division]</strong></span><br><br>";
	  }
	  echo "<strong>$team[teamname] - ($team[shirtcolor] shirts)</strong><br>  RegDate: $team[reg_start]<br>RegDone: $team[reg_done]";
	  $cpt = mssql_query("SELECT firstname, lastname, shirtsize, feepaid, feememo FROM captain WHERE c_id = $team[captain]",$conn);
	  $c = mssql_fetch_assoc($cpt);
	  
	  if($team["locked"] == 1)
	  {
	  		echo "  (Locked)";
	  }
	  else
	  {
	  		echo " ";
	  }	
	  echo "<br>";  

UNFORTUNATELY, no working :(

 

	  if($team["locked"] == 1)
	  {
	  		echo "<span style='color:red;'>(locked)</span>";
	  else
	  {
	  		echo " ";
	  }	
	  echo "<br>";

 

I get this error:

Parse error: parse error, unexpected T_ELSE in E:\... php on line 61

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.