2013-10-13 65 views
0

我想知道如何使用film.php创建表内的表,因为我希望它不显示表背景或表,如果$ count不是> 0?也许有一种方法可以在没有任何内容的情况下自动折叠表格。在表格中隐藏表格?

<table align="center" width="806" border="0" background="images/backg.jpg" cellpadding="4"> 

<tr><td> 

<?php 
include 'film.php'; 
?> 

</td></tr> 
</table> 

这是我的film.php文件?

if($count > 0){ 
echo "<table>"; 
echo "<table border='0' width='800' align='center' >"; 

echo " 
    <td width='40%' align='center'></td> 
<td width='20%' align='center'></td> 
<td width='40%' align='center'></td>"; 
echo "</tr>"; 

$row_number = 1; 
while ($row = mysql_fetch_array($result)) { 

$id_actor= $row["id_actor"]; 
$idfilm= $row["idfilm"]; 
$filmTitle= $row["filmTitle"]; 
$filmRole= $row["filmRole"]; 
$filmDirector= $row["filmDirector"]; 

for ($i=0; $i<3; $i++) { 
    echo"<td><font color=\"white\"> $row[$i]</td>"; 
} 
echo"</tr>"; 

$row_number++; 
} 
echo"</table>"; 

回答

0

当然可以。只是将二者结合起来是这样的:

<?php 
if($count > 0){ 
    echo '<table align="center" width="806" border="0" background="images/backg.jpg" cellpadding="4">'; 
    echo '<tr><td>'; 
    echo "<table>"; 
    echo "<table border='0' width='800' align='center'>"; 
    echo "<td width='40%' align='center'></td> 
     <td width='20%' align='center'></td> 
     <td width='40%' align='center'></td>"; 
    echo "</tr>"; 
    $row_number = 1; 
    while ($row = mysql_fetch_array($result)) { 
    $id_actor= $row["id_actor"]; 
    $idfilm= $row["idfilm"]; 
    $filmTitle= $row["filmTitle"]; 
    $filmRole= $row["filmRole"]; 
    $filmDirector= $row["filmDirector"]; 
    for ($i=0; $i<3; $i++) { 
     echo"<td><font color=\"white\"> $row[$i]</td>"; 
    } 
    echo"</tr>"; 
    $row_number++; 
    } 
    echo "</table>"; 
    echo '</td></tr>'; 
    echo '</table>'; 
} 
?> 

而改变的第一部分,只是这样的:

<?php 
include 'film.php'; 
?>