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>";  

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.