我正在尝试从数据库中获取图像,并使用php mysql在每行中显示2个图像。我的代码只显示2张图像,其余图像不显示。这是代码
CSS
.image-inner {
position: relative;
width: 150px;
display: inline-block;
}
PHP
$res=mysql_query("select * from table1");
echo "<div class=view1>";
$i=0;
echo "<table>";
echo "<tr>";
while($row=mysql_fetch_array($res)){
if($i % 4 == 0) {
echo "<td>";
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image1'] ).'" class=image-inner height="200" width="200"/>';
echo "<br>";
echo $row['name1'];
echo "<br>";
echo $row['designation'];
}
echo "</td>";
$i++;
}
echo "</tr>";
echo "</table>";
?>