0
我有一個關於隱藏空列的問題。用Php隱藏列
如何隱藏< th>姓名</th>當我有空列的頭列?
在接下來的日子裏我工作到SWITH到mysqli的所有查詢:-)
QUERY
$query = " SELECT * FROM users ";
$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);
TABLE
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>NAME</th>
<th>SURNAME</th>
</tr>
</thead>
<tbody>
<?php
$i=0;
while ($i < $num) {
$id = mysql_result($result,$i,"id");
$name = mysql_result($result,$i,"name");
$surname = mysql_result($result,$i,"surname");
?>
<tr>
<td><?php echo $name; ?></td>
<td><?php echo $surname; ?></td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
只是做呼應'
http://php.net/manual/en/function.empty.php --- http://php.net/manual/en/control-structures.if.php --- http://php.net /manual/en/language.operators.comparison.php –
回答
要隱藏列,您需要同時前檢查。
在此之後,插入條件,只要你喜歡,並加入到頭表:
來源
2017-03-05 00:00:17 user1504222
試試這個!只要把一個如果檢查姓氏如果存在或不。並在回聲中包含標籤。
來源
2017-03-04 20:07:12
其
我已編輯您可以檢查的代碼。 –
相關問題