0

$count が > 0 でない場合にテーブルの背景またはテーブルを表示したくないという理由だけで、film.php を使用してテーブル内にこのテーブルを作成する方法を知りたいですか? テーブルに何もない場合、テーブルを自動的に折りたたむ方法があるかもしれません。

<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>";
4

1 に答える 1

0

もちろん。この2つを次のように組み合わせるだけです:

<?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';
?> 
于 2013-10-13T02:45:49.570 に答える