[英]PHP hiding link name in table row
The following code displays usually 2 columns with links names Engagement report
and Personal report
. 以下代码通常显示两列,其链接名称为“
Engagement report
和“ Personal report
。
There are instances where the second hyperlink field $ccP
is empty, and I want the cell also to appear empty and not as Personal report
在某些情况下,第二个超链接字段
$ccP
为空,我希望该单元格也显示为空而不是作为“ Personal report
Please help in achieving that. 请帮助实现这一目标。
while($row = mysql_fetch_array($login)){
$Report=$row['ReportName'];
$cc=$row['LinkEngagement'];
$ccP=$row['LinkPersonal'];
print "<tr class='alt'>
<td align='Left'>$Report</td>
<td align='Center'><a href='$cc' style='cursor:pointer' >Engagement report </a></td>
<td align='Center'><a href='$ccP' style='cursor:pointer' >Personal report </a></td>
</tr>";
}
print "</table>";
Check if $ccP
has something assigned to it, and only print if it does. 检查
$ccP
是否已为其分配了某些内容,并且只有在此情况下才打印。
if($ccP){
print "<td align='Center'><a href='$ccP' style='cursor:pointer' >Personal report </a></td>";
}
while($row = mysql_fetch_array($login)){
$Report=$row['ReportName'];
$cc=$row['LinkEngagement'];
$ccP=$row['LinkPersonal'];
$ccPLink=(empty($ccp)) ? "" : $ccp ;
print "<tr class='alt'>
<td align='Left'>$Report</td>
<td align='Center'><a href='$cc' style='cursor:pointer'>Engagement report </a></td>
<td align='Center'><a href='$ccP' style='cursor:pointer'>$ccpLink </a></td>
</tr>";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.