Re: php conditional formatting question
| From: | Guru Geek | Date: | Tue, 28 Jan 2003 15:53:43 +0000 |
| Subject: | Re: php conditional formatting question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133391@lists.php.net to get a copy of this message | ||
I'm new to PHP but I had a similar problem. I was comparing information in a
flat text file with a variable in my php code. They never matched according to
the php. I echo'd both values to the screen and they matched. So then I echo'd
them to the screen with three 'a' in front and three 'a' in back of the values.
Much to my suspicion there was a blank space behind the value from the text
file. So, I used rtrim to get rid of the blank space. Looks something like
this:
$contents[1] = rtrim($contents[1]);
if ($idname = = $contents[0]) {
echo "Works Thus Far!";
exit;
}
Hope this is helpful! ! !
Roger
WMB wrote:
> I know it's possible, but I just can't get it working.
> In an old file I have a straight php coding doc where it's used and am now
> trying to mimic the resulting output.
>
> I'm trying to get a result from a query in a specific color when it fits the
> bill
> (
> if ($teamcaptain == $deelnemer)
> //if yes, we'll make the result green
> echo "<td class="achtergrondbottom">"; etc
>
> (((((SEE BELOW))))))
>
> when the person ($deelnemer) also fits the $teamcaptain I want this one to
> be listed in different format, I dont care if it's only color or if it's a
> css.
> Hope there's someone able to help me here, thanks,
>
> Martin
> The Netherlands
>
> part of php code:
>
> do { ?>
> <tr class="laag2">
> <?php $teamcaptain = strtoupper($row_rsCompetitie['tmcap']);echo
> $teamcaptain;
> $deelnemer = strtoupper($row_rsCompetitie['zoekcode']);echo $deelnemer;?>
> <?php
> if ($teamcaptain == $deelnemer)
> //if yes, we'll make the result green
> echo "<td class="achtergrondbottom">";
> }
> ?>
> <td><?php echo $row_rsCompetitie['zoekcode']; ?></td>
> <td class="achtergrondgrijs"><?php echo
> $row_rsCompetitie['roepnaam'];
> ?></td>
> <td><?php echo $row_rsCompetitie['samennaam']; ?></td>
> <td><?php echo $row_rsCompetitie['handicap']; ?></td>
> <td><?php echo $row_rsCompetitie['tmnaam']; ?></td>
> <td><?php echo $row_rsCompetitie['tmklasse']; ?></td>
> <td><?php echo $row_rsCompetitie['tmpoule']; ?></td>
> </tr>
> <?php } while ($row_rsCompetitie = mysql_fetch_assoc($rsCompetitie)); ?>
> </table>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php