嵌入式数据库内容仅显示备用行

时间:2015-08-17 13:46:52

标签: php embed

当我将以下行添加到代码中以显示我的数据库内容时,数据库仅显示奇数行

<td>" ."<iframe  width=150 height=150 src=\"". $row['Video_Address'] ."\"   alt=\"\"\ /</iframe>". "</td>

以下是删除违规行时可以使用的代码。由于页面总共有200行,因此不适合显示整个页面。

echo '<table style="display: inline-block"><table width="2500" border="0"  align="center" cellpadding="2" cellspacing="0">';
echo "<table border='1'>
<table bgcolor='#FFFFFF'>
    <tr>
        <th>Order</th>
        <th>Theme</th>
        <th>Full Page<br>Associated<br>with Video</th>
        <th>Video<br>Address</th>
        <th>Associated<br>Comments</th>
        <th>Associated<br>Quiz</th>
        <th>Creator</th>  
</tr>";

while ($row=mysql_fetch_array($sql2)) {
   if ($color == 1) {
       echo "<tr bgcolor='#708020'>
        <td>" . $row['MyOrder'] . "</td>
        <td>" . $row['Theme'] . "</td>
        <td><a href=". 'Videos.php?Videos_Name='.$row['Videos_Name'].'&Videos_Name='.$row['Videos_Name'].' "</a>'.$row['Videos_Name']."</td>
        <td>" ."<iframe  width=150 height=150 src=\"". $row['Video_Address'] ."\" alt=\"\"\ /</iframe>". "</td>
        <td>" . $row['Associated_Comments'] . "</td>
        <td>" . $row['Associated_Quiz'] . "</td>
        <td>" ."<img src=\"". $row['Avatar'] ."\" alt=\"\" />"."</br><p align='center'><a href=". 'Member_Profile.php?username='.$row['Creator'].' "</a>'.$row['Creator']."</td>
        </tr>";

         $color = "2";
    } else {
        echo "<tr bgcolor='#BFB7C7'>
        <td>" . $row['MyOrder'] . "</td>
        <td>" . $row['Theme'] . "</td>
        <td><a href=". 'Videos.php?Videos_Name='.$row['Videos_Name'].'&Videos_Name='.$row['Videos_Name'].' "</a>'.$row['Videos_Name']."</td>
        <td>" ."<iframe  width=150 height=150 src=\"". $row['Video_Address'] ."\" alt=\"\"\ /</iframe>". "</td>
        <td>" . $row['Associated_Comments'] . "</td>
        <td>" . $row['Associated_Quiz'] . "</td>
        <td>" ."<img src=\"". $row['Avatar'] ."\" alt=\"\" />"."</br><p align='center'><a href=". 'Member_Profile.php?username='.$row['Creator'].' "</a>'.$row['Creator']."</td>
        </tr>";

        $color="1";
    }
}
echo "</table>";

不能想出为什么只显示奇数行的明显解释。我可以随时删除它,但想了解为什么某些东西不起作用。希望有人能提供帮助。当我摆脱备用行着色代码并使用一种彩色显示模式时,也无法工作。

1 个答案:

答案 0 :(得分:0)

由于某些我无法解释的原因,我已经将错误的代码添加了两次,以便它读取,并且嘿presto我得到奇数偶数,而没有重复包含两列并排包含相同的嵌入视频两次。我仍然喜欢解释,但至少页面有效! :)

<td>" ."<iframe  width=150 height=150 src=\"". $row['Video_Address'] ."\"    alt=\"\"\ /</iframe>". "</td>
<td>" ."<iframe  width=150 height=150 src=\"". $row['Video_Address'] ."\" alt=\"\"\ /</iframe>". "</td>