我想在一个单元格中显示两个图片变量
http://i.imgur.com/9ZuRhnD.gif
$result = mysqli_query($query)
or die(mysql_error());
if (mysqli_num_rows($result) > 0) {
echo "<table border='0' style='border-collapse: collapse;border-color: white;'>";
$i = 0;
while($row = mysqli_fetch_array($result)){
$Limg = $row['Limg'];
$Limgt = $row['Limgt'];
if ($i==0) {
echo "<tr>\n";
}
echo "<td align='center' width='140'>" . "<img src=\"{$row['Limgt']}\">" ."</td>";
echo "<td align='center' width='40'>" . "<img src=\"{$row['Limg']}\">" ."</td>";
$i++;
if ($i == $items) {
echo "</tr>\n";
$i = 0;
}
}
echo '</table>';
}else {
echo 'no records found';
}
?>
我缺少什么
答案 0 :(得分:0)
你将它们分别放在自己的单元格中() - 试试这个:
$result = mysqli_query($query)
or die(mysql_error());
if (mysqli_num_rows($result) > 0) {
echo "<table border='0' style='border-collapse: collapse;border-color: white;'>";
$i = 0;
while($row = mysqli_fetch_array($result)){
$Limg = $row['Limg'];
$Limgt = $row['Limgt'];
if ($i==0) {
echo "<tr>\n<td>";
}
echo "<img src=\"{$row['Limgt']}\">";
echo "<img src=\"{$row['Limg']}\">";
$i++;
if ($i == $items) {
echo "</td></tr>\n";
$i = 0;
}
}
echo '</table>';
}else {
echo 'no records found';
}
?>
答案 1 :(得分:0)
你是在两个TD中制作它们所以你必须在一个TD中制作它们
echo "<td align='center' width='140'>
<img src=\"{$row['Limgt']}\">
<img src=\"{$row['Limg']}\">
</td>";