p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

php_databases thread: RE: php_databases digest: January 08, 2003


Message #1 by "Michael Conway" <mconway3@c...> on Wed, 8 Jan 2003 20:32:07 -0500
I'm not certain what you are looking for, but you may want to add a
function to an include file or directly to your script, this is simple
and works.  Something like:
<?php
function color($variable)
{
if($variable < 5)
 {
	echo "<h3><font color = \"red\">$variable</font></h3>";
	
  } 
elseif( $variable == 5)
  {
	echo "<h3><font color = \"white\">$variable</font></h3>";
  }
else
  
	echo "<h3><font color = \"blue\">$variable</font></h3>";
}


$variable=4;
color($variable);

?>

Hope it is of some help.

Michael Conway
mconway3@c...
(xxx) xxx-xxxx
 

-----Original Message-----
From: php_databases digest [mailto:php_databases@p...] 
Sent: Wednesday, January 08, 2003 7:07 PM
To: php_databases digest recipients
Subject: php_databases digest: January 08, 2003

-----------------------------------------------
When replying to the digest, please quote only
relevant material, and edit the subject line to
reflect the message you are replying to.
-----------------------------------------------

The URL for this list is:
http://p2p.wrox.com/list.asp?list=php_databases
PHP_DATABASES Digest for Wednesday, January 08, 2003.

1. can't change variable font color according to it's value
2. Re: can't change variable font color according to it's value
3. Re: can't change variable font color according to it's value

----------------------------------------------------------------------

Subject: can't change variable font color according to it's value
From: "Nikolopoulos Athanasios" <istion@o...>
Date: Wed, 8 Jan 2003 10:30:14
X-Message-Number: 1

hi community,
new to php, not new to problems!
I vainly tried to change the font color of a $variable, according to
it's 
value.
the $variable represents the result of a mysql query and if it's value
is, 
let's say superior to 5, I would like to turn the value string into red,

for example. The value must be insered into an html table but not in a 
predefined place so it is not possible to simply do <font 
color=ff0000>$variable</font>. 
Any one know how is this possible, or where may I have information about

the problem?
thanks for any possible help
Athanasios Nikolopoulos
----------------------------------------------------------------------

Subject: Re: can't change variable font color according to it's value
From: "K.S.Mutthu Kumaar" <ksmutthu@a...>
Date: Wed, 8 Jan 2003 16:35:51 +0530
X-Message-Number: 2

You can have a field for the font color value. So for superior will have
the
color values set in his record. or else you can have a separate table
with
different color paremeters for different details for different users.
Based on that you can set the font tag like this
<font color=<?php echo $user_design_color;?>$variable</font>

Hope I understood your problem way well.

Mutthu
----- Original Message -----
From: "Nikolopoulos Athanasios" <istion@o...>
To: "php_databases" <php_databases@p...>
Sent: Wednesday, January 08, 2003 10:30 AM
Subject: [php_databases] can't change variable font color according to
it's
value


> hi community,
> new to php, not new to problems!
> I vainly tried to change the font color of a $variable, according to
it's
> value.
> the $variable represents the result of a mysql query and if it's value
is,
> let's say superior to 5, I would like to turn the value string into
red,
> for example. The value must be insered into an html table but not in a
> predefined place so it is not possible to simply do <font
> color=ff0000>$variable</font>.
> Any one know how is this possible, or where may I have information
about
> the problem?
> thanks for any possible help
> Athanasios Nikolopoulos
>



----------------------------------------------------------------------

Subject: Re: can't change variable font color according to it's value
From: Rich Holmes <holmesra@w...>
Date: Wed, 8 Jan 2003 05:38:27 -0700
X-Message-Number: 3

Another way (possible) is an IF statement
I use something similar to display certain rows in a table based upon 
usr  access level
Certain rows are only visible if you have certain access rights.
<?
  if ($variable > 5)
   {
?>
  <td><font color="#dcdcdc">How ever you display the
variable</font></td>
<?
  }
  else
   {
  ?>
  <td><font color = "#000000">How ever you display the 
variable</font></td>
<?
  }
?>

On Wednesday, January 8, 2003, at 04:05 AM, K.S.Mutthu Kumaar wrote:

> You can have a field for the font color value. So for superior will 
> have the
> color values set in his record. or else you can have a separate table 
> with
> different color paremeters for different details for different users.
> Based on that you can set the font tag like this
> <font color=<?php echo $user_design_color;?>$variable</font>
>
> Hope I understood your problem way well.
>
> Mutthu
> ----- Original Message -----
> From: "Nikolopoulos Athanasios" <istion@o...>
> To: "php_databases" <php_databases@p...>
> Sent: Wednesday, January 08, 2003 10:30 AM
> Subject: [php_databases] can't change variable font color according to

> it's
> value
>
>
>> hi community,
>> new to php, not new to problems!
>> I vainly tried to change the font color of a $variable, according to 
>> it's
>> value.
>> the $variable represents the result of a mysql query and if it's 
>> value is,
>> let's say superior to 5, I would like to turn the value string into 
>> red,
>> for example. The value must be insered into an html table but not in
a
>> predefined place so it is not possible to simply do <font
>> color=ff0000>$variable</font>.
>> Any one know how is this possible, or where may I have information 
>> about
>> the problem?
>> thanks for any possible help
>> Athanasios Nikolopoulos
>>
>
>
>
>




---

END OF DIGEST




  Return to Index