如何删除包含特定php值的表行


How to strike out a table row which caries a particular php value?

我想将text-decoration:line-through应用到一个表行,这将按照mysql查询循环。只有当变量的值不感兴趣

时,我才想去掉行 在下面的循环中,

有一个id为line的表行。还有一个变量$status。我希望标签行得到剔除,如果$status的值来"不感兴趣",我怎么能做到这一点?

    while ($prow=mysql_fetch_object($productname))
        {
        $pname.=$prow->name.'<br />';
        }

     $staffname=mysql_query("select name from staff where sid='$assignedto' or flag='$assignedto'");
        if(mysql_num_rows($staffname) > 1)
        {
        echo "<tr id='line'";
        if($count %2==0)
        echo "bgcolor='white' style='height:10px;'";
        echo ">";
        $count++;
        ?>
    <td>
    <span class="time"><a title="<?echo $added;?>" ></a></span>

        </td>
        <?
        echo "<td >".$name. "</td>";
        echo "<td>".$status."</td>";
        echo "<td >".$phone." "."|"." ".$mobile. "</td>";
        // echo "<td >".$email. "</td>";
        echo "<td >".$city. "</td>";

        echo "<td >".$pname. "</td>";
        echo "<td >".$sname. "</td>";
        echo "<td >".$lastactivity. "</td>";
    ?>
 </table>

像这样:

if ($status == 'Not Interested') { $strike = 'text-decoration:line-through'; }
else { $strike = ''; }

然后

echo "<tr id='line'";
if($count %2==0)
echo "bgcolor='white' style='height:10px; $strike'";
echo ">";

如果$status不是'Not Interested',它将简单地添加''而不是text-decoration:line-through

在循环中,您可以检查$status的值,如果它匹配"Not Interested",您只需向该行添加一个特定的CSS类(例如:class="line-through"),然后像这样在CSS中处理其余的内容:

tr.line-through td{
    text-decoration:line-through
}