Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为登录用户提供不同的颜色_Php_Mysql_Mysqli - Fatal编程技术网

Php 为登录用户提供不同的颜色

Php 为登录用户提供不同的颜色,php,mysql,mysqli,Php,Mysql,Mysqli,我有一个登录名,一旦你登录,你就会看到一个包含数据库中所有用户的列表 我想用红色之类的颜色突出显示列表中的登录用户。我怎样才能做到这一点?基本上: <table> <?php foreach($users as &$user) { ?> <tr> <td<?php if ($user == $currentUser) print(" style=\"background-color=red;\""); ?>&

我有一个登录名,一旦你登录,你就会看到一个包含数据库中所有用户的列表

我想用红色之类的颜色突出显示列表中的登录用户。我怎样才能做到这一点?

基本上:

<table>
<?php 
foreach($users as &$user) {
?>
    <tr>
        <td<?php if ($user == $currentUser) print(" style=\"background-color=red;\""); ?>>
            <?php print($user); ?>
        </td>
    </tr>
<?php
}
?>
</table>

您可以设置html元素的不同样式,可能是边框颜色或背景颜色。