PHP:当我显示我的表,我击中一个空值,我希望它抛出一个错误


PHP: when i display my table and i hit an empty value i want it to throw an error

我正在寻找一个问题的答案,我目前有。我有一个表,显示48行和大约10列。大多数列都用值填充,但有些列是空的。我想找到这些字段,并给它一个红色的边框,以便他们弹出时,我显示在一个表。

目前我正在连接2个表在一起,并显示他们与while循环。是否有一种方法来选择空单元格并使边界为红色?


表:------------------------------
| col1 | col2 | col3 | col4 |
|------|---------|------|------|
| test | empty | test | test |
|------|---------|------|------|

所以我想让这个空单元格有一个红色边框

我现在有什么表:
------------------------------
| col1 | col2 | col3 | col4 |
|------|---------|------|------|
|空|
|------|---------|------|------|
如果需要更多的信息,我很乐意提供。

假设您正在使用table,您可以在显示数据

的循环中尝试这样做
<?php
if ($yourvariable == NULL || $yourvariable == "" ){
    ?>
    <td class="your colored class"></td>
<?php
}
    else{
    ?>
    <td class="your non colored class"></td>
<?php
}
?>
相关文章: